EDU.oswego.cs.dl.util.concurrent
Class LockedExecutor
java.lang.ObjectEDU.oswego.cs.dl.util.concurrent.LockedExecutor
- Executor
public class LockedExecutor
extends java.lang.Object
An implementation of Executor that
invokes the run method of the supplied command within
a synchronization lock and then returns.
[
Introduction to this package. ]
LockedExecutor(Sync mutex)- Create a new LockedExecutor that relies on the given mutual
exclusion lock.
|
void | execute(Runnable command)- Execute the given command directly in the current thread,
within the supplied lock.
|
mutex_
protected final Sync mutex_
The mutex *
LockedExecutor
public LockedExecutor(Sync mutex)
Create a new LockedExecutor that relies on the given mutual
exclusion lock.
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.
execute
public void execute(Runnable command)
throws InterruptedException Execute the given command directly in the current thread,
within the supplied lock.
- execute in interface Executor