org.infinispan.distexec
Interface DistributedExecutorService

All Superinterfaces:
Executor, ExecutorService
All Known Implementing Classes:
DefaultExecutorService

public interface DistributedExecutorService
extends ExecutorService

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 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.

Since:
5.0
Author:
Manik Surtani, Vladimir Blagojevic
See Also:
DefaultExecutorService, DistributedCallable

Method Summary
<T,K> Future<T>
submit(Callable<T> task, K... input)
          Submits given Callable task for an execution on a single Infinispan node.
<T> List<Future<T>>
submitEverywhere(Callable<T> task)
          Submits the given Callable task for an execution on all available Infinispan nodes.
<T,K> List<Future<T>>
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 interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
 
Methods inherited from interface java.util.concurrent.Executor
execute
 

Method Detail

submit

<T,K> Future<T> submit(Callable<T> task,
                       K... input)
Submits given Callable task for an 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 cluster
input - input keys for this task, effective if and only if task is instance of DistributedCallable
Returns:
a Future representing pending completion of the task

submitEverywhere

<T> List<Future<T>> submitEverywhere(Callable<T> task)
Submits the given Callable task for an 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<Future<T>> 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.

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 cluster
input - input keys for this task, effective if and only if task is instance of DistributedCallable
Returns:
a list of Futures, one future per Infinispan cluster node where task was executed

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.