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,
Externalizable, or Streamable. Also the value returned from
a callable must Serializable, Externalizable, 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 JChannel |
ch |
| Constructor and Description |
|---|
ExecutionService() |
ExecutionService(JChannel ch) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.lang.Runnable command) |
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(JChannel 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 JChannel 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(JChannel ch)
public void setChannel(JChannel 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 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-2009 Bela Ban / Red Hat. All Rights Reserved.