public boolean tryLock() { final boolean success = delegate.tryLock(); // if the lock was successfully acquired, record the current Thread as a lock holder if (success) threadsHoldingLock.add(Thread.currentThread()); return success; }
public boolean tryLock() { final boolean success = delegate.tryLock(); // if the lock was successfully acquired, record the current Thread as a lock holder if (success) threadsHoldingLock.add(Thread.currentThread()); return success; }
@Override public boolean tryLock() { if (this.readLock!=null && this.readLock.getThreadsHoldingLock().contains(Thread.currentThread())) { throw new IllegalStateException("DebugList detected an attempt to acquire a writeLock from a thread already owning a readLock (deadlock)"); } final boolean success = delegate.tryLock(); // if the lock was successfully acquired, record the current Thread as a lock holder if (success) threadsHoldingLock.add(Thread.currentThread()); return success; }