public class LatchedExecutor extends Object implements Executor
Semaphore
. New tasks can
start iff the latch is non-zero. The maximum parallelism is the minimum of
the value specified to the constructor and the potential parallelism of the
delegate service.
Note: The pattern for running tasks on this service is generally to
execute(Runnable)
a Runnable
and to make that
Runnable
a FutureTask
if you want to await the Future
of a Runnable
or Callable
or otherwise manage its execution.
Note: This class can NOT be trivially wrapped as an ExecutorService
since the resulting delegation pattern for submit() winds up invoking
execute() on the delegate ExecutorService
rather than on this class.
Constructor and Description |
---|
LatchedExecutor(Executor executor,
int nparallel) |
Modifier and Type | Method and Description |
---|---|
void |
execute(Runnable r) |
int |
getNParallel()
Return the maximum parallelism allowed by this
Executor . |
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.