wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Deadlock question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Deadlock question" Watch "Deadlock question" New topic
Author

Deadlock question

Ramses Tutoli
Greenhorn

Joined: Sep 05, 2003
Posts: 26
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?
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deadlock question
 
Similar Threads
About:My URLyBird1.3.2 Locking
Locking & Exceptions (B&S)
No RecordNotFoundException would be thrown in the body of Data.unlock() method
How can a deadlock occur in a thin client?
lock-delete-unlock and RecordNotFoundException