This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: until the desired resource becomes available... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: until the desired resource becomes available..." Watch "B&S: until the desired resource becomes available..." New topic
Author

B&S: until the desired resource becomes available...

Michael Cox
Greenhorn

Joined: Sep 04, 2008
Posts: 10
Hi,

Bodgitt and Scarper 2.1.1

"Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available."

I felt it was really bad to do this to a GUI user so my locking solution puts uses a lock request with a timeout. This puts the lock in a TIMED_WAIT rather than a WAIT state.

I'm pretty sure that consumes no CPU cycles but its not really blocking until the resource is available.

And of course now I'm about to submit and I'm in a flap about this.

Its says "should" rather than "must" which helps.

Does anyone have any good/bad experiences submitting this sort of approach?

Michael
 
wood burning stoves
 
subject: B&S: until the desired resource becomes available...