de.grogra.util
| Modifier and Type | Method and Description |
|---|---|
void |
executeWithoutWriteLock(java.lang.Runnable callback)
Executes
callback while temporarily reducing this write lock to a read lock. |
Lockable |
getLockable()
Returns the resource on which this lock is held.
|
boolean |
isWriteLock()
Returns the type of lock.
|
void |
retain()
A lock may be retained by invocation of this method within the
LockProtectedRunnable.run(boolean, Lock) method of a task. |
void executeWithoutWriteLock(java.lang.Runnable callback)
throws java.lang.InterruptedException
callback while temporarily reducing this write lock to a read lock.
This gives threads waiting for a read lock the chance to execute.java.lang.IllegalStateException - if this lock is not a write lockjava.lang.InterruptedException - if this thread is interrupted while reacquiring the write lock. In this case the lock stays a read lockLockable getLockable()
boolean isWriteLock()
void retain()
LockProtectedRunnable.run(boolean, Lock) method of a task. In
this case, the lock is not released after the task has been finished:
The lock remains active and has to be passed to one of the
execute methods in Lockable which take a lock
as parameter, only then the lock will be released.