• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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.
 
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic