public interface LockPromise
InfinispanLock.
This promise does not means that the lock is acquired. The lock is acquired when the lock() method is
invoked. It contains the basic method to check it state (when it is available or not) and it allows adding listeners
to it.
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(LockListener listener)
Adds a
LockListener to be invoked when the lock is available. |
boolean |
isAvailable()
It tests if the lock is available.
|
void |
lock()
It locks the key (or keys) associated to this promise.
|
boolean isAvailable()
The lock is consider available when it is successfully acquired or the timeout is expired. In any case, when it
returns true, the lock() will never block.
true if the lock is available (or the timeout is expired), false otherwise.void lock() throws InterruptedException, TimeoutException
This method will block until the lock is available or the timeout is expired.
InterruptedException - if the current thread is interrupted while acquiring the lockTimeoutException - if we are unable to acquire the lock after a specified timeout.void addListener(LockListener listener)
LockListener to be invoked when the lock is available.
The acquired parameter indicates that the lock is acquired (when it is true) or it timed out (when
it is false).
listener - the LockListener to invoke.Copyright © 2025 JBoss, a division of Red Hat. All rights reserved.