public class LimitedPooledExecutor extends Object implements ExecutorService
ExecutorService that forwards the tasks
to the GlobalPooledExecutor. Keeps track of
the number of tasks in flight and limits them. The idea is to have a
lightweight ExecutorService implementation for a particular task which
has no big creation and shutdown overhead.
Right now the thread limit is a fixed value. Maybe we implement an adaptive behaviour, that increases the thread count as long as throughput is increasing, too. Idea: Implementation similar to TCP congestion control? TODO-C: change to adaptive behaviour
| Modifier and Type | Class and Description |
|---|---|
static interface |
LimitedPooledExecutor.ExceptionListener |
static interface |
LimitedPooledExecutor.NeverRunInCallingTask<V>
Marker interface for a Callable to indicate that we need the
calling task to continue after the submit and a new thread for
the Callable.
|
static class |
LimitedPooledExecutor.Tunable |
| Constructor and Description |
|---|
LimitedPooledExecutor(GlobalPooledExecutor gpe) |
LimitedPooledExecutor(GlobalPooledExecutor gpe,
LimitedPooledExecutor.Tunable t) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long _timeout,
TimeUnit _unit) |
void |
execute(Runnable r) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> _tasks) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> _tasks,
long _timeout,
TimeUnit _unit) |
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks)
Not supported.
|
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
Not supported.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
setExceptionListener(LimitedPooledExecutor.ExceptionListener exceptionListener) |
void |
shutdown() |
List<Runnable> |
shutdownNow()
Identical to
shutdown. |
<T> Future<T> |
submit(Callable<T> c) |
Future<?> |
submit(Runnable r) |
<T> Future<T> |
submit(Runnable r,
T _result) |
public LimitedPooledExecutor(GlobalPooledExecutor gpe)
public LimitedPooledExecutor(GlobalPooledExecutor gpe, LimitedPooledExecutor.Tunable t)
public void setExceptionListener(LimitedPooledExecutor.ExceptionListener exceptionListener)
public void shutdown()
shutdown in interface ExecutorServicepublic List<Runnable> shutdownNow()
shutdown. Since we hand over everything to the
global executor, implementing this would mean we need to keep track of
out submitted task and finished tasks. Since we have no long running tasks
there is no real benefit to implement this.shutdownNow in interface ExecutorServicepublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorServicepublic boolean awaitTermination(long _timeout, TimeUnit _unit) throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedExceptionpublic <T> Future<T> submit(Callable<T> c)
submit in interface ExecutorServicepublic <T> Future<T> submit(Runnable r, T _result)
submit in interface ExecutorServicepublic Future<?> submit(Runnable r)
submit in interface ExecutorServicepublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> _tasks) throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> _tasks, long _timeout, TimeUnit _unit) throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionTimeoutExceptioncache2k API documentation. Copyright © 2000–2015 headissue GmbH, Munich.