public class ExecutionService
extends java.util.concurrent.AbstractExecutorService
ExecutionRunner to start picking up requests.
Every future object returned will be a NotifyingFuture which
allows for not having to query the future and have a callback instead. This
can then be used as a workflow to submit other tasks sequentially or also to
query the future for the value at that time.
Every callable or runnable submitted must be either Serializable or
Streamable. Also the value returned from
a callable must Serializable or
Streamable. Unfortunately if the value returned is not serializable
then a NotSerializableException will be thrown as the cause.
| Modifier and Type | Class and Description |
|---|---|
static class |
ExecutionService.DistributedFuture<V>
This is basically a copy of the FutureTask in java.util.concurrent but
added serializable to it.
|
protected static class |
ExecutionService.RunnableAdapter<T>
This is copied from
Executors class which
contains RunnableAdapter. |
| Modifier and Type | Field and Description |
|---|---|
protected Executing |
_execProt |
protected java.util.concurrent.atomic.AtomicBoolean |
_shutdown |
protected java.util.concurrent.locks.Condition |
_unfinishedCondition |
protected java.util.Set<java.util.concurrent.Future<?>> |
_unfinishedFutures |
protected java.util.concurrent.locks.Lock |
_unfinishedLock |
protected Channel |
ch |
| Constructor and Description |
|---|
ExecutionService() |
ExecutionService(Channel ch) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.lang.Runnable command) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isShutdown() |
boolean |
isTerminated() |
protected <T> java.util.concurrent.RunnableFuture<T> |
newTaskFor(java.util.concurrent.Callable<T> callable) |
protected <T> java.util.concurrent.RunnableFuture<T> |
newTaskFor(java.lang.Runnable runnable,
T value) |
void |
setChannel(Channel ch) |
void |
shutdown() |
java.util.List<java.lang.Runnable> |
shutdownNow() |
<T> NotifyingFuture<T> |
submit(java.util.concurrent.Callable<T> task) |
<T> NotifyingFuture<T> |
submit(java.lang.Runnable task,
T result) |
protected Channel ch
protected Executing _execProt
protected java.util.concurrent.locks.Lock _unfinishedLock
protected java.util.concurrent.locks.Condition _unfinishedCondition
protected java.util.Set<java.util.concurrent.Future<?>> _unfinishedFutures
protected java.util.concurrent.atomic.AtomicBoolean _shutdown
public ExecutionService()
public ExecutionService(Channel ch)
public void setChannel(Channel ch)
public <T> NotifyingFuture<T> submit(java.lang.Runnable task, T result)
submit in interface java.util.concurrent.ExecutorServicesubmit in class java.util.concurrent.AbstractExecutorServicepublic <T> NotifyingFuture<T> submit(java.util.concurrent.Callable<T> task)
submit in interface java.util.concurrent.ExecutorServicesubmit in class java.util.concurrent.AbstractExecutorServicepublic void shutdown()
public java.util.List<java.lang.Runnable> shutdownNow()
public boolean isShutdown()
public boolean isTerminated()
public boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
invokeAny in interface java.util.concurrent.ExecutorServiceinvokeAny in class java.util.concurrent.AbstractExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
invokeAny in interface java.util.concurrent.ExecutorServiceinvokeAny in class java.util.concurrent.AbstractExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic void execute(java.lang.Runnable command)
protected <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.lang.Runnable runnable,
T value)
newTaskFor in class java.util.concurrent.AbstractExecutorServiceprotected <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.util.concurrent.Callable<T> callable)
newTaskFor in class java.util.concurrent.AbstractExecutorServiceCopyright © 1998-2020 Red Hat. All Rights Reserved.