| Interface | Description |
|---|---|
| LockManagerListener<LockType> |
Interface implemented by objects that are informed of changes in the locks
currently held.
|
| LockPolicy<LockType> |
A lock policy defines how a locking mechanism works.
|
| LockPreChecker<LockType> |
A lock pre-checker is informed of all locks currently held and decides
whether a lock (which cannot be obtained right now) can be queued for
later acquisition.
|
| WaitQueueFactory<LockType> |
Factory that creates wait queues for targets.
|
| Class | Description |
|---|---|
| FifoWaitQueue<LockType> |
Wait queue that keeps requests in a FIFO queue.
|
| FifoWaitQueueFactory<LockType> |
Factory that creates
FifoWaitQueue. |
| LockGrant<LockType> |
A lock grant represents the successful acquisition of a lock.
|
| LockGrantFuture<LockType> |
Future representing a request for a lock grant.
|
| LockManager<LockType> |
The lock manager holds information about all locks currently held and all
locks currently being waited for.
|
| LockRequest<LockType> |
Request for a lock.
|
| NullLockPreChecker<LockType> |
Lock pre-checker that accepts waiting for all locks, possibly generating
a deadlock.
|
| Target<LockType> |
A target is an object that can be locked.
|
| WaitQueue<LockType> |
A wait queue manages lock requests that are pending for a target,
deciding in which order should the locks be obtained.
|
| Exception | Description |
|---|---|
| CyclicTargetHierarchyException |
Exception thrown setting the parent of a target would make a cycle.
|
| DifferentLockManagersException |
Exception thrown setting the parent of a target to a target that has a
different lock manager.
|
| HierarchyChangeBreaksChainException |
Exception thrown when changing the target hierarchy would break existing
lock chains.
|
| LockCancelledException |
Exception thrown when a lock is cancelled by another thread and the current
thread was waiting for the lock.
|
| NotLockedException |
Exception thrown when an operation expecting a locked lock finds an
unlocked lock.
|
In locklib, a locking target is represented by a
Target. All locks are managed by a LockManager.
Holders can be any java object.
To request a lock, a LockRequest is created and requested to
the target using Target.lock(LockRequest). This method returns
a LockGrantFuture, an object that can be used to synchronously
or asynchronously obtain the lock. A lock itself is represented by a
LockGrant (which can be obtained from the
LockGrantFuture). To release a lock, the
LockGrant.release() method should be used.
Copyright © 2015. All rights reserved.