|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectEDU.oswego.cs.dl.util.concurrent.LockedExecutor
public class LockedExecutor
An implementation of Executor that invokes the run method of the supplied command within a synchronization lock and then returns.
[ Introduction to this package. ]
Field Summary | |
---|---|
protected Sync |
mutex_
The mutex |
Constructor Summary | |
---|---|
LockedExecutor(Sync mutex)
Create a new LockedExecutor that relies on the given mutual exclusion lock. |
Method Summary | |
---|---|
void |
execute(java.lang.Runnable command)
Execute the given command directly in the current thread, within the supplied lock. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Sync mutex_
Constructor Detail |
---|
public LockedExecutor(Sync mutex)
mutex
- Any mutual exclusion lock.
Standard usage is to supply an instance of Mutex
,
but, for example, a Semaphore initialized to 1 also works.
On the other hand, many other Sync implementations would not
work here, so some care is required to supply a sensible
synchronization object.Method Detail |
---|
public void execute(java.lang.Runnable command) throws java.lang.InterruptedException
execute
in interface Executor
java.lang.InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |