• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic