Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Deadlock question

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right now in my code, I think deadlock can occur in LocalDataClient/RemoteDataClientImpl after a record is locked but before a record is unlocked if an exception is thrown in one of the methods. For example, take the following code in my LocalDataClient class:

if an exception is thrown in my call to db.delete(), the record never has a chance to unlock. Would it be ok to put my db.unlock() method in a finally{} clause to fix this?
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ramses,
A db.unlock() call from a finally{} clause sounds good to me. Notice though that the security brought by your finally clause will be higher if your method is running server-side.
Best,
Phil.
reply
    Bookmark Topic Watch Topic
  • New Topic