permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Information return form lock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Information return form lock" Watch "Information return form lock" New topic

Information return form lock

Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
I use the Object as the key and recordNum as the
value in the LockManager.
Now I wonder :
1. When the lock -1 has occured ,should any other
client which wants to get lock be waiting or be
informed something.
2. If I want to informed the client sth,how to do? Maybe throw a exception,right?

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

Ray the general thought on this issue is that you can safely assume that only the server when shutting down will call lock(-1).
When the server is then shutdown, any client still "connected" will start getting IOExceptions or other networking related exception, which you should already be handling on the client side, and that will be your "Message" that will be shown to the client.

Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
It is sorta covered in the JavaRanch Style Guide.
subject: Information return form lock
Similar Threads
Passed ... :-) ....
How does multiple calls to lock cause Deadlock?
URLyBIRD lock question
Where did you hear of the ranch ?
Deadlock on the thin cleint