SCJP, SCJD, now studying for SCWCD and working to be a better person
John R Roberts
Joined: Dec 27, 2006
Hi, I implemented my locking using the new classes introduced in Java 5, namely the java.util.concurrent.locks.ReentrantLock and java.util.concurrent.locks.Condition. I keep a HashMap of cookies and record numbers. If the record number is already in the Hashmap then I wait until it is released. I know it is released using the Condition object. I liked the new classes above as they remove alot of the "understanding" required when using the java Monitor methods (wait, notify, notifAll).
As for why I lost marks on the Network Server - I have no idea. I thought my solution was quite good, using the Adapter pattern.
Joined: Sep 13, 2007
I have also done my locking in a similar manner..thanks for the information.