|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.concurrent.AbstractExecutorService
org.infinispan.distexec.DefaultExecutorService
public class DefaultExecutorService
Infinispan's implementation of an ExecutorService and DistributedExecutorService.
This ExecutorService provides methods to submit tasks for an execution on a cluster of Infinispan
nodes.
Note that due to potential task migration to another nodes every Callable,
Runnable and/or DistributedCallable submitted must be either Serializable
or Externalizable. Also the value returned from a callable must be Serializable
or Externalizable. Unfortunately if the value returned is not serializable then a
NotSerializableException will be thrown.
| Field Summary | |
|---|---|
protected AdvancedCache |
cache
|
protected CommandsFactory |
factory
|
protected InterceptorChain |
invoker
|
protected AtomicBoolean |
isShutdown
|
protected Marshaller |
marshaller
|
protected RpcManager |
rpc
|
| Constructor Summary | |
|---|---|
DefaultExecutorService(Cache masterCacheNode)
Create a new DefaultExecutorService given a master cache node. |
|
| Method Summary | ||
|---|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit)
|
|
protected
|
clone(Callable<T> task)
|
|
void |
execute(Runnable command)
|
|
protected
|
executeFuture(Address address,
org.infinispan.distexec.DefaultExecutorService.DistributedRunnableFuture<T> f)
|
|
|
invokeAny(Collection<? extends Callable<T>> tasks)
|
|
|
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
|
|
protected
|
invokeLocally(org.infinispan.distexec.DefaultExecutorService.DistributedRunnableFuture<T> future)
|
|
boolean |
isShutdown()
|
|
boolean |
isTerminated()
|
|
protected
|
mapKeysToNodes(K... input)
|
|
protected
|
newTaskFor(Callable<T> callable)
|
|
protected
|
newTaskFor(Runnable runnable,
T value)
|
|
protected List<Address> |
randomClusterMembers(List<Address> members,
int numNeeded)
|
|
protected Address |
selectExecutionNode()
|
|
protected Address |
selectExecutionNode(List<Address> candidates)
|
|
void |
shutdown()
|
|
List<Runnable> |
shutdownNow()
|
|
|
submit(Callable<T> task)
|
|
|
submit(Callable<T> task,
K... input)
Submits given Callable task for an execution on a single Infinispan node. |
|
|
submit(Runnable task,
T result)
|
|
|
submitEverywhere(Callable<T> task)
Submits the given Callable task for an execution on all available Infinispan nodes. |
|
|
submitEverywhere(Callable<T> task,
K... input)
Submits the given Callable task for an execution on all available Infinispan nodes using input keys specified by K input. |
|
| Methods inherited from class java.util.concurrent.AbstractExecutorService |
|---|
invokeAll, invokeAll, submit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.concurrent.ExecutorService |
|---|
invokeAll, invokeAll, submit |
| Field Detail |
|---|
protected final AtomicBoolean isShutdown
protected final AdvancedCache cache
protected final RpcManager rpc
protected final InterceptorChain invoker
protected final CommandsFactory factory
protected final Marshaller marshaller
| Constructor Detail |
|---|
public DefaultExecutorService(Cache masterCacheNode)
masterCacheNode - cache node initiating map reduce task| Method Detail |
|---|
public <T> NotifyingFuture<T> submit(Runnable task,
T result)
submit in interface ExecutorServicesubmit in class AbstractExecutorServicepublic <T> NotifyingFuture<T> submit(Callable<T> task)
submit in interface ExecutorServicesubmit in class AbstractExecutorServicepublic void shutdown()
shutdown in interface ExecutorServicepublic List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorService
public boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
throws InterruptedException,
ExecutionException
invokeAny in interface ExecutorServiceinvokeAny in class AbstractExecutorServiceInterruptedException
ExecutionException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
invokeAny in interface ExecutorServiceinvokeAny in class AbstractExecutorServiceInterruptedException
ExecutionException
TimeoutExceptionpublic void execute(Runnable command)
execute in interface Executor
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable,
T value)
newTaskFor in class AbstractExecutorServiceprotected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
newTaskFor in class AbstractExecutorService
public <T,K> Future<T> submit(Callable<T> task,
K... input)
DistributedExecutorServiceExecution environment will chose an arbitrary node N hosting some or all of the keys specified as input. If all keys are not available locally at node N they will be retrieved from the cluster.
submit in interface DistributedExecutorServicetask - a task to execute across Infinispan clusterinput - input keys for this task, effective if and only if task is instance of DistributedCallable
public <T> List<Future<T>> submitEverywhere(Callable<T> task)
DistributedExecutorService
submitEverywhere in interface DistributedExecutorServicetask - a task to execute across Infinispan cluster
public <T,K> List<Future<T>> submitEverywhere(Callable<T> task,
K... input)
DistributedExecutorServiceExecution environment will chose all nodes in Infinispan cluster where input keys are local, migrate given Callable instance to those nodes, execute it and return result as a list of Futures
submitEverywhere in interface DistributedExecutorServicetask - a task to execute across Infinispan clusterinput - input keys for this task, effective if and only if task is instance of DistributedCallable
protected <T> Callable<T> clone(Callable<T> task)
protected <T> void executeFuture(Address address,
org.infinispan.distexec.DefaultExecutorService.DistributedRunnableFuture<T> f)
protected <T> void invokeLocally(org.infinispan.distexec.DefaultExecutorService.DistributedRunnableFuture<T> future)
protected <K> Map<Address,List<K>> mapKeysToNodes(K... input)
protected Address selectExecutionNode(List<Address> candidates)
protected Address selectExecutionNode()
protected List<Address> randomClusterMembers(List<Address> members,
int numNeeded)
|
--> | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||