public void unlock(T t) { synchronized (locks) { LockHolder lock = locks.get(t); if (lock == null) throw new IllegalStateException("No lock found."); //$NON-NLS-1$ lock.unlock(); // If, after unlocking, no other thread is using the lock, discard it. if (lock.decremementUseCount() == 0) { locks.remove(t); } } } }
lock = locks.get(t); if (lock == null) { lock = new LockHolder(); locks.put(t, lock); lock.incrementUseCount(); acquired = lock.tryLock(time, unit); return acquired; } finally { synchronized (locks) { if (lock.decremementUseCount() == 0) { locks.remove(t);
lock = locks.get(t); if (lock == null) { lock = new LockHolder(); locks.put(t, lock); lock.incrementUseCount(); acquired = lock.tryLock(time, unit); return acquired; } finally { synchronized (locks) { if (lock.decremementUseCount() == 0) { locks.remove(t);
lock = locks.get(t); if (lock == null) { lock = new LockHolder(); locks.put(t, lock); lock.incrementUseCount(); acquired = lock.tryLock(time, unit); return acquired; } finally { synchronized (locks) { if (lock.decremementUseCount() == 0) { locks.remove(t);
lock = locks.get(t); if (lock == null) { lock = new LockHolder(); locks.put(t, lock); lock.incrementUseCount(); acquired = lock.tryLock(time, unit); return acquired; } finally { synchronized (locks) { if (lock.decremementUseCount() == 0) { locks.remove(t);
lock = locks.get(t); if (lock == null) { lock = new LockHolder(); locks.put(t, lock); lock.incrementUseCount(); acquired = lock.tryLock(time, unit); return acquired; } finally { synchronized (locks) { if (lock.decremementUseCount() == 0) { locks.remove(t);
public void unlock(T t) { synchronized (locks) { LockHolder lock = locks.get(t); if (lock == null) throw new IllegalStateException("No lock found."); //$NON-NLS-1$ lock.unlock(); // If, after unlocking, no other thread is using the lock, discard it. if (lock.decremementUseCount() == 0) { locks.remove(t); } } } }
public void unlock(T t) { synchronized (locks) { LockHolder lock = locks.get(t); if (lock == null) throw new IllegalStateException("No lock found."); //$NON-NLS-1$ lock.unlock(); // If, after unlocking, no other thread is using the lock, discard it. if (lock.decremementUseCount() == 0) { locks.remove(t); } } } }
public void unlock(T t) { synchronized (locks) { LockHolder lock = locks.get(t); if (lock == null) throw new IllegalStateException("No lock found."); //$NON-NLS-1$ lock.unlock(); // If, after unlocking, no other thread is using the lock, discard it. if (lock.decremementUseCount() == 0) { locks.remove(t); } } } }
public void unlock(T t) { synchronized (locks) { LockHolder lock = locks.get(t); if (lock == null) throw new IllegalStateException("No lock found."); //$NON-NLS-1$ lock.unlock(); // If, after unlocking, no other thread is using the lock, discard it. if (lock.decremementUseCount() == 0) { locks.remove(t); } } } }