public interface LockHandler
In Strolch locking of objects is done by keeping a lock for every StrolchRootElement by using the
Locator to find the lock. Instead of adding a lock to the model, the lock is stored by the
LockHandler.
Since new StrolchRootElement might not be known by the ElementMaps but you still want to
lock an object globally, then locking on the Locator solves this, as the locator is an immutable object and
can easily be created before the actual object exists
See concrete implementations for which concrete locking implementation is used
DefaultLockHandler| Modifier and Type | Method and Description |
|---|---|
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. |
void lock(StrolchRootElement element) throws StrolchLockException
Locator 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
usedelement - the element for which a Lock on its Locator is to be created and/or lockedStrolchLockExceptionvoid unlock(StrolchRootElement element) throws StrolchLockException
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 releaseLock(StrolchRootElement)
element - the element for which the current/last Lock is to be unlockedStrolchLockExceptionvoid releaseLock(StrolchRootElement element) throws StrolchLockException
element - the element for which the Lock on the Locator is to be releasedStrolchLockExceptionCopyright © 2011–2016 Strolch. All rights reserved.