@Override public void lockInterruptibly() throws InterruptedException { if (hook != null) { hook.attemptingAcquisition(this); } lock.lockInterruptibly(); if (hook != null) { hook.lockAcquired(this); } }
@Override public void lock() { if (hook != null) { hook.attemptingAcquisition(this); } lock.lock(); if (hook != null) { hook.lockAcquired(this); } }
@Override public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException { if (hook != null) { hook.attemptingAcquisition(this); } boolean result = lock.tryLock(timeout, unit); if (result && (hook != null)) { hook.lockAcquired(this); } return result; }
@Override public boolean tryLock() { if (hook != null) { hook.attemptingAcquisition(this); } boolean result = lock.tryLock(); if (result && (hook != null)) { hook.lockAcquired(this); } return result; }
@Override public void unlock() { lock.unlock(); if (hook != null) { hook.lockReleased(this); } }