public interface OrderLockManager
| Modifier and Type | Method and Description |
|---|---|
Object |
acquireLock(Order order)
Blocks the requesting thread until able to acquire a lock for the given order.
|
Object |
acquireLockIfAvailable(Order order)
This method differs from
acquireLock(Order) in that it will not block if the lock is currently
held by a different caller. |
boolean |
isActive()
This method indicates if the lock manager is active.
|
void |
releaseLock(Object lockObject)
Releases the given lockObject and notifies any threads that are waiting on that object that they are able to
attempt to acquire the lock.
|
Object acquireLock(Order order)
releaseLock(Object), passing in the Object returned
from this call once their critical section has executed. The suggested idiom for this operation is:
Object lockObject = null;
try {
lockObject = orderLockManager.acquireLock(order);
// Do something
} finally {
orderLockManager.releaseLock(lockObject);
}order - releaseLock(Object) once
the operation that required a lock has completed.Object acquireLockIfAvailable(Order order)
acquireLock(Order) in that it will not block if the lock is currently
held by a different caller. In the case that the lock was not able to be immediately acquired, this method
will return null.order - acquireLock(Order)void releaseLock(Object lockObject)
lockObject - boolean isActive()
Copyright © 2015. All Rights Reserved.