Register / Login
Win a copy of
Java 9 Revealed
this week in the
Features new in Java 9
this forum made possible by our volunteer staff, including ...
Roel De Nijs
Stephan van Hulst
Developer Certification (OCMJD)
B&S: until the desired resource becomes available...
posted 8 years ago
Bodgitt and Scarper 2.1.1
"Any attempt to lock a resource that is already locked
cause the current
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?
It is sorta covered in the
JavaRanch Style Guide
Boost this thread!
Locking, about sentence: "consuming no CPU cycles"
My Locking Approach
Blocks synchronized, but without wait() or notifyAll() methods.
My Locking Method: please, advise me.