public interface DistributedExecutorService
Every DistributedExecutorService is bound to one particular cache. Tasks submitted will have
access to key/value pairs from that particular cache if and only if the task submitted is an
instance of DistributedCallable. Also note that there is nothing preventing a user from
submitting a familiar Runnable or Callable just like to any other
ExecutorService. However, DistributedExecutorService, as it name implies, will likely
migrate submitted Callable or Runnable to another JVM in Infinispan cluster, execute it and
return a result to task invoker.
Note that due to potential task migration to other 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.
DefaultExecutorService,
DistributedCallable| Modifier and Type | Method and Description |
|---|---|
<T> DistributedTaskBuilder<T> |
createDistributedTaskBuilder(Callable<T> callable)
Returns DistributedTaskBuilder for this DistributedExecutorService and a given Callable.
|
<T> NotifyingFuture<T> |
submit(Address target,
Callable<T> task)
Submits the given Callable task for execution on the specified target Infinispan node.
|
<T> NotifyingFuture<T> |
submit(Address target,
DistributedTask<T> task)
Submits the given DistributedTask for execution on the specified target Infinispan node.
|
<T,K> NotifyingFuture<T> |
submit(Callable<T> task,
K... input)
Submits the given Callable task for execution on a single Infinispan node.
|
<T,K> NotifyingFuture<T> |
submit(DistributedTask<T> task,
K... input)
Submits the given DistributedTask for execution on a single Infinispan node.
|
<T> List<Future<T>> |
submitEverywhere(Callable<T> task)
Submits the given Callable task for execution on all available Infinispan nodes.
|
<T,K> List<Future<T>> |
submitEverywhere(Callable<T> task,
K... input)
Submits the given Callable task for execution on all available Infinispan nodes using input
keys specified by K input.
|
<T> List<Future<T>> |
submitEverywhere(DistributedTask<T> task)
Submits the given DistributedTask for execution on all available Infinispan nodes.
|
<T,K> List<Future<T>> |
submitEverywhere(DistributedTask<T> task,
K... input)
Submits the given DistributedTask for execution on all available Infinispan nodes using input
keys specified by K input.
|
<T> NotifyingFuture<T> submit(Address target, Callable<T> task)
T - target - address of Infinispan node selected for execution of the tasktask - a task to execute on selected Infinispan node<T> NotifyingFuture<T> submit(Address target, DistributedTask<T> task)
T - target - address of Infinispan node selected for execution of the tasktask - a task to execute on selected Infinispan node<T,K> NotifyingFuture<T> submit(Callable<T> task, K... input)
Execution 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.
task - a task to execute across Infinispan clusterinput - input keys for this task, effective if and only if task is instance of DistributedCallable<T,K> NotifyingFuture<T> submit(DistributedTask<T> task, K... input)
Execution 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.
task - a DistributedTask to execute across Infinispan clusterinput - input keys for this task, effective if and only if task's callable is instance of
DistributedCallable<T> List<Future<T>> submitEverywhere(Callable<T> task)
task - a task to execute across Infinispan cluster<T> List<Future<T>> submitEverywhere(DistributedTask<T> task)
task - a task to execute across Infinispan cluster<T,K> List<Future<T>> submitEverywhere(Callable<T> task, K... input)
Execution 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
task - a task to execute across Infinispan clusterinput - input keys for this task, effective if and only if task is instance of DistributedCallable<T,K> List<Future<T>> submitEverywhere(DistributedTask<T> task, K... input)
Execution 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
task - a task to execute across Infinispan clusterinput - input keys for this task, effective if and only if task is instance of DistributedCallable<T> DistributedTaskBuilder<T> createDistributedTaskBuilder(Callable<T> callable)
T - callable - the execution unit of DistributedTaskDistributedTaskCopyright © 2015 JBoss, a division of Red Hat. All rights reserved.