Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.
if the Condition belongs to the master lock then ALL threads will be notified
Condition factors out the Object monitor methods (wait, notify and notifyAll) into distinct objects to give the effect of having multiple wait-sets per object
Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.
well associating a Condition at a record level can help you implement a way to notify waiting threads
Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.
Condition - It is a much better idea and better programming technique to associate the Condition with the creator of the Lock. More so you instantiating the Condition from the "masterLock" variable and then referencing the Condition to the LockInformation. Have you considered the to make the LockInformation class of type ReentrantLock? In that way you can instantiate a new Condition object which is now attached to the owner?
lockInfo.getCondition().signalAll() - why are you using signalAll and not signal?
Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.
Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.
Consider Paul's rocket mass heater. |