示例#1
0
 // Release the lock by setting state to zero
 protected boolean tryRelease(int releases) {
   assert releases == 1; // Otherwise unused
   if (getState() == 0) throw new IllegalMonitorStateException();
   setExclusiveOwnerThread(null);
   setState(0);
   return true;
 }
示例#2
0
 // Deserialize properly
 private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
   s.defaultReadObject();
   setState(0); // reset to unlocked state
 }