Package org.jgroups.blocks.executor
Class ExecutionService
java.lang.Object
java.util.concurrent.AbstractExecutorService
org.jgroups.blocks.executor.ExecutionService
- All Implemented Interfaces:
AutoCloseable,Executor,ExecutorService
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis is basically a copy of the FutureTask in java.util.concurrent but added serializable to it.protected static final classThis is copied from class which contains RunnableAdapter. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Executingprotected AtomicBooleanprotected Conditionprotected Lockprotected JChannel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) voidbooleanbooleanprotected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) voidsetChannel(JChannel ch) voidshutdown()<T> NotifyingFuture<T> <T> NotifyingFuture<T> Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
close
-
Field Details
-
ch
-
_execProt
-
_unfinishedLock
-
_unfinishedCondition
-
_unfinishedFutures
-
_shutdown
-
-
Constructor Details
-
ExecutionService
public ExecutionService() -
ExecutionService
-
-
Method Details
-
setChannel
-
submit
- Specified by:
submitin interfaceExecutorService- Overrides:
submitin classAbstractExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService- Overrides:
submitin classAbstractExecutorService
-
shutdown
public void shutdown() -
shutdownNow
-
isShutdown
public boolean isShutdown() -
isTerminated
public boolean isTerminated() -
awaitTermination
- Throws:
InterruptedException
-
execute
-
newTaskFor
- Overrides:
newTaskForin classAbstractExecutorService
-
newTaskFor
- Overrides:
newTaskForin classAbstractExecutorService
-