/** Execute the given command directly in the current thread, within the supplied lock. */ public void execute(Runnable command) throws InterruptedException { mutex_.acquire(); try { command.run(); } finally { mutex_.release(); } }
/** Try to acquire sync before a reader operation; record failure * */ protected boolean beforeRead() { try { rd_.acquire(); return false; } catch (InterruptedException ex) { syncFailures_.increment(); return true; } }
public void clear() { try { wr_.acquire(); try { c_.clear(); } finally { wr_.release(); } } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new UnsupportedOperationException(); } }
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(); } }
public void lock() { sync.acquire(1); }
@Override public void lock() { sync.acquire(1); }