Interface DistributedExecutorService
-
- All Superinterfaces:
Executor
,ExecutorService
- All Known Implementing Classes:
DefaultExecutorService
public interface DistributedExecutorService extends ExecutorService
Deprecated.since 9.1 Please useClusterExecutor
orCacheStream
instead.An ExecutorService that provides methods to submit tasks for execution on a cluster of Infinispan nodes.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 familiarRunnable
orCallable
just like to any otherExecutorService
. 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/orDistributedCallable
submitted must be eitherSerializable
orExternalizable
. Also the value returned from a callable must beSerializable
orExternalizable
. Unfortunately if the value returned is not serializable then aNotSerializableException
will be thrown.All
CompletableFuture
returned to the caller may be cancelled, however if interruption is desired, (ie. mayInterruptIfRunning == true), it will only be performed if done on the original CompletableFuture returned via one of the various submit methods. Any chained futures from the original will only attempt to cancel the task result. If interruption is needed and this task was found to be operating on a remote node it will send a cancellation command to the remote node in an attempt to stop it early using standard javaThread.interrupt()
on the thread processing that task.- Since:
- 5.0
- Author:
- Manik Surtani, Vladimir Blagojevic
- See Also:
DefaultExecutorService
,DistributedCallable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description <T> DistributedTaskBuilder<T>
createDistributedTaskBuilder(Callable<T> callable)
Deprecated.Returns DistributedTaskBuilder for this DistributedExecutorService and a given Callable.<T,K>
CompletableFuture<T>submit(Callable<T> task, K... input)
Deprecated.Submits the given Callable task for execution on a single Infinispan node.<T,K>
CompletableFuture<T>submit(DistributedTask<T> task, K... input)
Deprecated.Submits the given DistributedTask for execution on a single Infinispan node.<T> CompletableFuture<T>
submit(Address target, Callable<T> task)
Deprecated.Submits the given Callable task for execution on the specified target Infinispan node.<T> CompletableFuture<T>
submit(Address target, DistributedTask<T> task)
Deprecated.Submits the given DistributedTask for execution on the specified target Infinispan node.<T> List<CompletableFuture<T>>
submitEverywhere(Callable<T> task)
Deprecated.Submits the given Callable task for execution on all available Infinispan nodes.<T,K>
List<CompletableFuture<T>>submitEverywhere(Callable<T> task, K... input)
Deprecated.Submits the given Callable task for execution on all available Infinispan nodes using input keys specified by K input.<T> List<CompletableFuture<T>>
submitEverywhere(DistributedTask<T> task)
Deprecated.Submits the given DistributedTask for execution on all available Infinispan nodes.<T,K>
List<CompletableFuture<T>>submitEverywhere(DistributedTask<T> task, K... input)
Deprecated.Submits the given DistributedTask for execution on all available Infinispan nodes using input keys specified by K input.-
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
-
-
-
-
Method Detail
-
submit
<T> CompletableFuture<T> submit(Address target, Callable<T> task)
Deprecated.Submits the given Callable task for execution on the specified target Infinispan node.- Type Parameters:
T
-- Parameters:
target
- address of Infinispan node selected for execution of the tasktask
- a task to execute on selected Infinispan node- Returns:
- a Future representing pending completion of the task
-
submit
<T> CompletableFuture<T> submit(Address target, DistributedTask<T> task)
Deprecated.Submits the given DistributedTask for execution on the specified target Infinispan node.- Type Parameters:
T
-- Parameters:
target
- address of Infinispan node selected for execution of the tasktask
- a task to execute on selected Infinispan node- Returns:
- a Future representing pending completion of the task
-
submit
<T,K> CompletableFuture<T> submit(Callable<T> task, K... input)
Deprecated.Submits the given Callable task for execution on a single Infinispan node.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.
- Parameters:
task
- a task to execute across Infinispan clusterinput
- input keys for this task, effective if and only if task is instance ofDistributedCallable
- Returns:
- a Future representing pending completion of the task
-
submit
<T,K> CompletableFuture<T> submit(DistributedTask<T> task, K... input)
Deprecated.Submits the given DistributedTask for execution on a single Infinispan node.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.
- Parameters:
task
- a DistributedTask to execute across Infinispan clusterinput
- input keys for this task, effective if and only if task's callable is instance ofDistributedCallable
- Returns:
- a Future representing pending completion of the task
-
submitEverywhere
<T> List<CompletableFuture<T>> submitEverywhere(Callable<T> task)
Deprecated.Submits the given Callable task for execution on all available Infinispan nodes.- Parameters:
task
- a task to execute across Infinispan cluster- Returns:
- a list of Futures, one future per Infinispan cluster node where task was executed
-
submitEverywhere
<T> List<CompletableFuture<T>> submitEverywhere(DistributedTask<T> task)
Deprecated.Submits the given DistributedTask for execution on all available Infinispan nodes.- Parameters:
task
- a task to execute across Infinispan cluster- Returns:
- a list of Futures, one future per Infinispan cluster node where task was executed
-
submitEverywhere
<T,K> List<CompletableFuture<T>> submitEverywhere(Callable<T> task, K... input)
Deprecated.Submits the given Callable task for execution on all available Infinispan nodes using input keys specified by 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
- Parameters:
task
- a task to execute across Infinispan clusterinput
- input keys for this task, effective if and only if task is instance ofDistributedCallable
- Returns:
- a list of Futures, one future per Infinispan cluster node where task was executed
-
submitEverywhere
<T,K> List<CompletableFuture<T>> submitEverywhere(DistributedTask<T> task, K... input)
Deprecated.Submits the given DistributedTask for execution on all available Infinispan nodes using input keys specified by 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
- Parameters:
task
- a task to execute across Infinispan clusterinput
- input keys for this task, effective if and only if task is instance ofDistributedCallable
- Returns:
- a list of Futures, one future per Infinispan cluster node where task was executed
-
createDistributedTaskBuilder
<T> DistributedTaskBuilder<T> createDistributedTaskBuilder(Callable<T> callable)
Deprecated.Returns DistributedTaskBuilder for this DistributedExecutorService and a given Callable. As it name implies clients can use DistributedTaskBuilder to create DistributedTask instances.- Type Parameters:
T
-- Parameters:
callable
- the execution unit of DistributedTask- Returns:
- DistributedTaskBuilder to create
DistributedTask
-
-