Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes lockedRecords.notifyAll() 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 "lockedRecords.notifyAll()" Watch "lockedRecords.notifyAll()" New topic
Author

lockedRecords.notifyAll()

Elena Taube
Greenhorn

Joined: Dec 06, 2005
Posts: 21
Hello all,

in some of the Data methods, I check if the current record locked or not. For this case I have defined a method, that return true, if the record is locked, otherwise false.

But I am not sure, should I call the lockedRecords.notifyAll() at the end of this method?

I call lockedRecords.notifyAll() only in the unlock method, to notify that the current record was unlocked. But what about if this method will be called in the delete method or in the update? Is it correct not to call lockedRecords.notifyAll() in this method?

Can you help me?
[ January 06, 2006: Message edited by: Elena Taube ]
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
My advise to you is not to call notifyAll() at all, as it goes contrary to Sun's specification of wasting no cycles. You might wish to use queues and call notify on monitor objects in those queues.


Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: lockedRecords.notifyAll()