Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

deleteMethod and unlock

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers:

I am trying to run concurrency test on delete method. My pseudo code is



Consider this scenario:
100 = lockRecord(5)
deleteRecord(5, 100)
unlock(5, 100)

lockRecord(5) will throw RNFE
unlock(5, 0) will throw Security Exception when in theory I was expecting RNFE.
unlock() method had only SecurityException and didnt have RecordNotFoundException in the signature in my
assignment. How is everyone handling this?

Thanks,

Harish
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi:
My assignment has RNFE on unlock method signature but
I didn't really throw it in my unlock method implementation.
The reason is if user delete a record, it makes sense there is no RNFE is thrown from unlock method. Unlock method should only remove this record from the locked list instead of checking the database file and then throw a RNFE.
If the second thread try to lock this record, the lock method will throw RNFE.
 
Harish Yerneni
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Lee.

Harish
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi;

also don't check if the record exist or not because your unlock don't throws it. so you are safe by just check for security exception.
my assignment tell me that the unlock throws SecurityException and RecordNotFoundException and i implements that and i will document that this case does not make sense as you talk.

Regards.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic