|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.crowd.manager.lock.DirectoryLockManager
public class DirectoryLockManager
Manages locks for synchronisation purposes, one per SynchronisableDirectory. Applies a standard naming strategy
for a key and delegates to a LockFactory
to construct the particular locks.
SynchronisableDirectory
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
Lock |
getLock(long directoryId)
Returns the lock for the directory with the given ID. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DirectoryLockManager()
ReentrantLockFactory
for lock construction.
public DirectoryLockManager(LockFactory lockFactory)
LockFactory
for lock construction.
lockFactory
- used to construct locks as required for each directoryMethod Detail |
---|
public 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 lock
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |