com.alexkasko.unsafe.offheapstruct
class LimitedInvoker extends Object
Executor
threads
those can be used simultaneously.Modifier and Type | Field and Description |
---|---|
private Executor |
executor |
private int |
maxThreads |
Constructor and Description |
---|
LimitedInvoker(Executor executor,
int maxThreads)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private void |
await(ExecutorCompletionService<Void> completer)
Waits for
Future to complete |
(package private) void |
invokeAll(Collection<? extends Runnable> tasks)
Executes all the tasks simultaneously using no more than
maxThreads threads from the executor |
private final int maxThreads
LimitedInvoker(Executor executor, int maxThreads)
executor
- executormaxThreads
- maximum number of simultaneously used threadsvoid invokeAll(Collection<? extends Runnable> tasks)
maxThreads
threads from the executortasks
- runnables to executeprivate void await(ExecutorCompletionService<Void> completer)
Future
to completecompleter
- executor serviceCopyright © 2014. All Rights Reserved.