public interface LockResource extends AutoCloseable
The returned auto closeable object in case LockManager.lock(String)
succeeds.
A LockResource object can be shared across threads and is thread-safe
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the
LockResource and unlocks (removes) the lock. |
Thread |
getHolder() |
Lock |
getLock() |
boolean |
isClosed() |
boolean |
isNewLock() |
boolean isClosed()
LockResource
has been closedvoid close()
LockResource
and unlocks (removes) the lock.
Note: unlike LockManager.unlock(String)
this may be invoked by another thread, allowing
delegation of unlocking the lock to another thread
Warning: while the LockResource may be closed by another thread, the lock itself remains tied to the thread
creating it!
Therefore the thread creating the lock must NOT be terminated before the other thread completes the
process requiring the lock, as the lock then may expire prematurely!
close
in interface AutoCloseable
Lock getLock()
Lock
for ths LockResource
boolean isNewLock()
getLock()
was created together with this LockResource
instance;
false if this getLock()
already was created earlier by the same thread creating this LockResource
.Thread getHolder()
Thread
that holds this LockResource
or null
in case the Thread
that created this lock has already stopped and been GC-edCopyright © 2012–2019 Hippo B.V. (http://www.onehippo.com). All rights reserved.