|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Lock
A Lock
on a Lockable
resource is either
a read lock or an exclusive write lock. It is acquired indirectly by one of
the execute
methods in Lockable
.
Method Summary | |
---|---|
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. |
Method Detail |
---|
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 lock
java.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.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |