public class DirectoryLockManager extends Object
LockFactory
to construct the particular locks.SynchronisableDirectory
Constructor and Description |
---|
DirectoryLockManager()
Constructs an instance that delegates to a
ReentrantLockFactory for lock construction. |
DirectoryLockManager(LockFactory lockFactory)
Constructs an instance that delegates to the provided
LockFactory for lock construction. |
public DirectoryLockManager()
ReentrantLockFactory
for lock construction.public DirectoryLockManager(LockFactory lockFactory)
LockFactory
for lock construction.lockFactory
- used to construct locks as required for each directorypublic Lock getLock(long directoryId)
Lock lock = directoryLockManager.getLock(directory.getId());
lock.lock();
try {
// access the resource protected by this lock
} finally {
lock.unlock();
}
directoryId
- the ID of the directory to lockCopyright © 2013 Atlassian. All Rights Reserved.