public class ReentrantLockFactory extends Object implements LockFactory
ReentrantLock
on each call to getLock(String)
.Constructor and Description |
---|
ReentrantLockFactory() |
public Lock getLock(String key)
LockFactory
Lock l = lockFactory.getLock("mylock");
l.lock();
try {
// access the resource protected by this lock
} finally {
l.unlock();
}
getLock
in interface LockFactory
key
- the key for this lockCopyright © 2013 Atlassian. All Rights Reserved.