public class DefaultLockHandler extends Object implements LockHandler
| Constructor and Description |
|---|
DefaultLockHandler(String realm,
TimeUnit tryLockTimeUnit,
long tryLockTime) |
| Modifier and Type | Method and Description |
|---|---|
String |
getRealm() |
void |
lock(StrolchRootElement element)
Locks the given element by using the element's
Locator and creating a lock on it. |
void |
releaseLock(StrolchRootElement element)
Releases the lock on the given element, by unlocking all locks, i.e.
|
void |
unlock(StrolchRootElement element)
Unlocks the given element by finding the element's lock by its
Locator. |
public String getRealm()
public void lock(StrolchRootElement element) throws StrolchLockException
LockHandlerLocator and creating a lock on it. Calling lock multiple
times from the same thread will not lock, it is up to the concrete implementation to define if a lock counter is
usedlock in interface LockHandlerelement - the element for which a Lock on its Locator is to be created and/or lockedStrolchLockExceptionpublic void unlock(StrolchRootElement element) throws StrolchLockException
LockHandler
Unlocks the given element by finding the element's lock by its Locator. It is up to the concrete
implementation to define if unlocking an unlocked element will fail or not. This method might not completely
unlock the element if a lock counter is used and the object was locked multiple times.
If the lock must be completely released, then use LockHandler.releaseLock(StrolchRootElement)
unlock in interface LockHandlerelement - the element for which the current/last Lock is to be unlockedStrolchLockExceptionpublic void releaseLock(StrolchRootElement element) throws StrolchLockException
LockHandlerreleaseLock in interface LockHandlerelement - the element for which the Lock on the Locator is to be releasedStrolchLockExceptionCopyright © 2011–2016 Strolch. All rights reserved.