com.atlassian.crowd.manager.lock
Class ReentrantLockFactory
java.lang.Object
com.atlassian.crowd.manager.lock.ReentrantLockFactory
- All Implemented Interfaces:
- LockFactory
public class ReentrantLockFactory
- extends Object
- implements LockFactory
A lock factory that creates a new instance of ReentrantLock
on each call to getLock(String)
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReentrantLockFactory
public ReentrantLockFactory()
getLock
public Lock getLock(String key)
- Description copied from interface:
LockFactory
- Get the lock for the specified key. Getting the lock does not imply that it has been acquired, you
still need to acquire and unlock the lock as normal.
Lock l = lockFactory.getLock("mylock");
l.lock();
try {
// access the resource protected by this lock
} finally {
l.unlock();
}
- Specified by:
getLock
in interface LockFactory
- Parameters:
key
- the key for this lock
- Returns:
- the lock for the key
Copyright © 2013 Atlassian. All Rights Reserved.