public interface LockProtectedRunnable
A
LockProtectedRunnable
represents a task which is to be
executed within the context of a Lock
on a
[@link de.grogra.util.Lockable} resource. The execution of the task is
induced by one of the execute
methods in
Lockable
.- Author:
- Ole Kniemeyer
-
Method Summary
-
Method Details
-
run
The invocation of this method is induced by one of theexecute
methods inLockable
. The thread which invokes this method possesses alock
as requested by the invocation ofexecute
. Ifsync
istrue
, the invocation is synchronous, meaning that it happens directly within the invocation of theexecute
method. Otherwise, the invocation is asynchronous, meaning that it happens later in a thread which may differ from the original thread.Normally, the lock is released after execution of
run
has finished. However, when the methodLock.retain()
has been invoked withinrun
, the lock is retained and remains active in order to be passed to one of theexecute
methods ofLockable
.- Parameters:
sync
- synchronous invocation?lock
- the lock which is currently acquired
-