org.jgroups.blocks.executor
Class ExecutionService
java.lang.Object
java.util.concurrent.AbstractExecutorService
org.jgroups.blocks.executor.ExecutionService
- All Implemented Interfaces:
- java.util.concurrent.Executor, java.util.concurrent.ExecutorService
public class ExecutionService
- extends java.util.concurrent.AbstractExecutorService
This is a jgroups implementation of an ExecutorService, where the consumers
are running on any number of nodes. The nodes should run
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.
- Since:
- 2.12.0
- Author:
- wburns
Methods inherited from class java.util.concurrent.AbstractExecutorService |
invokeAll, invokeAll, invokeAny, invokeAny, submit |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ch
protected JChannel ch
_execProt
protected Executing _execProt
_unfinishedLock
protected java.util.concurrent.locks.Lock _unfinishedLock
_unfinishedCondition
protected java.util.concurrent.locks.Condition _unfinishedCondition
_unfinishedFutures
protected java.util.Set<java.util.concurrent.Future<?>> _unfinishedFutures
_shutdown
protected java.util.concurrent.atomic.AtomicBoolean _shutdown
ExecutionService
public ExecutionService()
ExecutionService
public ExecutionService(JChannel ch)
setChannel
public void setChannel(JChannel ch)
submit
public <T> NotifyingFuture<T> submit(java.lang.Runnable task,
T result)
- Specified by:
submit
in interface java.util.concurrent.ExecutorService
- Overrides:
submit
in class java.util.concurrent.AbstractExecutorService
submit
public <T> NotifyingFuture<T> submit(java.util.concurrent.Callable<T> task)
- Specified by:
submit
in interface java.util.concurrent.ExecutorService
- Overrides:
submit
in class java.util.concurrent.AbstractExecutorService
shutdown
public void shutdown()
shutdownNow
public java.util.List<java.lang.Runnable> shutdownNow()
isShutdown
public boolean isShutdown()
isTerminated
public boolean isTerminated()
awaitTermination
public boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
execute
public void execute(java.lang.Runnable command)
newTaskFor
protected <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.lang.Runnable runnable,
T value)
- Overrides:
newTaskFor
in class java.util.concurrent.AbstractExecutorService
newTaskFor
protected <T> java.util.concurrent.RunnableFuture<T> newTaskFor(java.util.concurrent.Callable<T> callable)
- Overrides:
newTaskFor
in class java.util.concurrent.AbstractExecutorService
Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.