示例#1
0
 public void clear() {
   try {
     wr_.acquire();
     try {
       c_.clear();
     } finally {
       wr_.release();
     }
   } catch (InterruptedException ex) {
     Thread.currentThread().interrupt();
     throw new UnsupportedOperationException();
   }
 }
示例#2
0
 public Object remove(Object key) {
   try {
     wr_.acquire();
     try {
       return c_.remove(key);
     } finally {
       wr_.release();
     }
   } catch (InterruptedException ex) {
     Thread.currentThread().interrupt();
     throw new UnsupportedOperationException();
   }
 }
示例#3
0
 /** Clean up after a reader operation * */
 protected void afterRead(boolean wasInterrupted) {
   if (wasInterrupted) {
     Thread.currentThread().interrupt();
   } else rd_.release();
 }
示例#4
0
 public void unlock() {
   sync.release(1);
 }