|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.drools.concurrent.ExternalExecutorService
public class ExternalExecutorService
This class wraps up an externally managed executor service, meaning that the life cycle of the service is not managed by Drools. So, we intercept calls to shutdown() and shutdownNow() to not shutdown the external pool. Also, we need to maintain a list of tasks submitted to the external pool, so that they can be properly cancelled on a shutdown.
| Nested Class Summary | |
|---|---|
protected static class |
ExternalExecutorService.ObservableCallable<V>
This class is a wrapper around a Callable |
protected static class |
ExternalExecutorService.ObservableRunnable
This class is a wrapper around a Runnable task that will notify a listener when the task starts executing and when it finishes executing. |
protected static interface |
ExternalExecutorService.ObservableTask
A super interface for ObservableTasks |
protected static class |
ExternalExecutorService.TaskManager
An implementation of the TaskObserver interface that keeps a map of submitted, but not executed tasks. |
protected static interface |
ExternalExecutorService.TaskObserver
Interface that defines the methods to be implemented by a task observer. |
| Constructor Summary | |
|---|---|
ExternalExecutorService(ExecutorService delegate)
|
|
| Method Summary | ||
|---|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit)
Always returns true, if a shutdown was requested, since the life cycle of this executor is externally maintained. |
|
void |
execute(Runnable command)
|
|
List |
invokeAll(Collection tasks)
|
|
List |
invokeAll(Collection tasks,
long timeout,
TimeUnit unit)
|
|
Object |
invokeAny(Collection tasks)
|
|
Object |
invokeAny(Collection tasks,
long timeout,
TimeUnit unit)
|
|
boolean |
isShutdown()
|
|
boolean |
isTerminated()
|
|
void |
shutdown()
|
|
List<Runnable> |
shutdownNow()
|
|
|
submit(Callable<T> task)
|
|
Future<?> |
submit(Runnable task)
|
|
|
submit(Runnable task,
T result)
|
|
void |
waitUntilEmpty()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExternalExecutorService(ExecutorService delegate)
| Method Detail |
|---|
public void waitUntilEmpty()
public boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedExceptionpublic void execute(Runnable command)
execute in interface Executor
public List invokeAll(Collection tasks,
long timeout,
TimeUnit unit)
throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedException
public List invokeAll(Collection tasks)
throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedException
public Object invokeAny(Collection tasks,
long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
invokeAny in interface ExecutorServiceInterruptedException
ExecutionException
TimeoutException
public Object invokeAny(Collection tasks)
throws InterruptedException,
ExecutionException
invokeAny in interface ExecutorServiceInterruptedException
ExecutionExceptionpublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorServicepublic void shutdown()
shutdown in interface ExecutorServicepublic List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic <T> Future<T> submit(Callable<T> task)
submit in interface ExecutorService
public <T> Future<T> submit(Runnable task,
T result)
submit in interface ExecutorServicepublic Future<?> submit(Runnable task)
submit in interface ExecutorService
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||