EmbeddedCacheManager.executor() or CacheStream instead.@Deprecated public class DefaultExecutorService extends AbstractExecutorService implements DistributedExecutorService
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.
| Modifier and Type | Field and Description |
|---|---|
protected AdvancedCache |
cache
Deprecated.
|
protected CancellationService |
cancellationService
Deprecated.
|
protected ClusteringDependentLogic |
clusterDependentLogic
Deprecated.
|
protected CommandsFactory |
factory
Deprecated.
|
protected AsyncInterceptorChain |
invoker
Deprecated.
|
protected AtomicBoolean |
isShutdown
Deprecated.
|
protected ExecutorService |
localExecutorService
Deprecated.
|
protected Marshaller |
marshaller
Deprecated.
|
static DistributedTaskFailoverPolicy |
NO_FAILOVER
Deprecated.
|
static DistributedTaskFailoverPolicy |
RANDOM_NODE_FAILOVER
Deprecated.
|
protected RpcManager |
rpc
Deprecated.
|
protected boolean |
takeExecutorOwnership
Deprecated.
|
| Constructor and Description |
|---|
DefaultExecutorService(Cache<?,?> masterCacheNode)
Deprecated.
Creates a new DefaultExecutorService given a master cache node for local task execution.
|
DefaultExecutorService(Cache<?,?> masterCacheNode,
ExecutorService localExecutorService)
Deprecated.
Creates a new DefaultExecutorService given a master cache node and an ExecutorService for
parallel execution of tasks ran on this node.
|
DefaultExecutorService(Cache<?,?> masterCacheNode,
ExecutorService localExecutorService,
boolean takeExecutorOwnership)
Deprecated.
Creates a new DefaultExecutorService given a master cache node and an ExecutorService for
parallel execution of task ran on this node.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit)
Deprecated.
|
protected <T> Callable<T> |
clone(Callable<T> task)
Deprecated.
|
<T> DistributedTaskBuilder<T> |
createDistributedTaskBuilder(Callable<T> callable)
Deprecated.
Returns DistributedTaskBuilder for this DistributedExecutorService and a given Callable.
|
protected <T,K> org.infinispan.distexec.DefaultExecutorService.DistributedTaskPart<T> |
createDistributedTaskPart(DistributedTask<T> task,
DistributedExecuteCommand<T> c,
Address target,
int failoverCount)
Deprecated.
|
protected <T,K> org.infinispan.distexec.DefaultExecutorService.DistributedTaskPart<T> |
createDistributedTaskPart(DistributedTask<T> task,
DistributedExecuteCommand<T> c,
List<K> inputKeys,
Address target,
int failoverCount)
Deprecated.
|
static ExecutorService |
createLocalExecutor(Cache<?,?> masterCacheNode)
Deprecated.
|
void |
execute(Runnable command)
Deprecated.
|
protected <T> List<Address> |
executionCandidates(DistributedTask<T> task)
Deprecated.
|
protected List<Address> |
getMembers()
Deprecated.
|
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks)
Deprecated.
|
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
Deprecated.
|
boolean |
isShutdown()
Deprecated.
|
boolean |
isTerminated()
Deprecated.
|
protected <K> Map<Address,List<K>> |
keysToExecutionNodes(DistributedTaskExecutionPolicy policy,
K... input)
Deprecated.
|
protected <T> RunnableFuture<T> |
newTaskFor(Callable<T> callable)
Deprecated.
|
protected <T> RunnableFuture<T> |
newTaskFor(Runnable runnable,
T value)
Deprecated.
|
protected List<Address> |
randomClusterMembers(List<Address> members,
int numNeeded)
Deprecated.
|
protected <T> Address |
selectExecutionNode(DistributedTask<T> task)
Deprecated.
|
protected Address |
selectExecutionNode(List<Address> candidates)
Deprecated.
|
void |
shutdown()
Deprecated.
|
List<Runnable> |
shutdownNow()
Deprecated.
|
<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> CompletableFuture<T> |
submit(Callable<T> task)
Deprecated.
|
<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(Runnable task,
T result)
Deprecated.
|
<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.
|
invokeAll, invokeAll, submitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinvokeAll, invokeAll, submitpublic static final DistributedTaskFailoverPolicy NO_FAILOVER
public static final DistributedTaskFailoverPolicy RANDOM_NODE_FAILOVER
protected final AtomicBoolean isShutdown
protected final AdvancedCache cache
protected final RpcManager rpc
protected final AsyncInterceptorChain invoker
protected final CommandsFactory factory
protected final Marshaller marshaller
protected final ExecutorService localExecutorService
protected final CancellationService cancellationService
protected final ClusteringDependentLogic clusterDependentLogic
protected final boolean takeExecutorOwnership
public DefaultExecutorService(Cache<?,?> masterCacheNode)
masterCacheNode - Cache node initiating distributed taskpublic DefaultExecutorService(Cache<?,?> masterCacheNode, ExecutorService localExecutorService)
Note that DefaultExecutorService will not shutdown client supplied localExecutorService once
this DefaultExecutorService is shutdown. Lifecycle management of a supplied ExecutorService is
left to the client
Also note that client supplied ExecutorService should not execute tasks in the caller's thread
( i.e rejectionHandler of ThreadPoolExecutor configured with {link
ThreadPoolExecutor.CallerRunsPolicy)
masterCacheNode - Cache node initiating distributed tasklocalExecutorService - ExecutorService to run local taskspublic DefaultExecutorService(Cache<?,?> masterCacheNode, ExecutorService localExecutorService, boolean takeExecutorOwnership)
masterCacheNode - Cache node initiating distributed tasklocalExecutorService - ExecutorService to run local taskstakeExecutorOwnership - if true ExecutorService.shutdown() and
ExecutorService.shutdownNow() method will shutdown
localExecutorService as wellpublic static ExecutorService createLocalExecutor(Cache<?,?> masterCacheNode)
public <T> DistributedTaskBuilder<T> createDistributedTaskBuilder(Callable<T> callable)
DistributedExecutorServicecreateDistributedTaskBuilder in interface DistributedExecutorServicecallable - the execution unit of DistributedTaskDistributedTaskpublic <T> CompletableFuture<T> submit(Runnable task, T result)
submit in interface ExecutorServicesubmit in class AbstractExecutorServicepublic <T> CompletableFuture<T> submit(Callable<T> task)
submit in interface ExecutorServicesubmit in class AbstractExecutorServicepublic void shutdown()
shutdown in interface ExecutorServiceprotected <T> List<Address> executionCandidates(DistributedTask<T> task)
public List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorServicepublic boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny in interface ExecutorServiceinvokeAny in class AbstractExecutorServiceInterruptedExceptionExecutionExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny in interface ExecutorServiceinvokeAny in class AbstractExecutorServiceInterruptedExceptionExecutionExceptionTimeoutExceptionpublic void execute(Runnable command)
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value)
newTaskFor in class AbstractExecutorServiceprotected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
newTaskFor in class AbstractExecutorServicepublic <T> CompletableFuture<T> submit(Address target, Callable<T> task)
DistributedExecutorServicesubmit in interface DistributedExecutorServicetarget - address of Infinispan node selected for execution of the tasktask - a task to execute on selected Infinispan nodepublic <T> CompletableFuture<T> submit(Address target, DistributedTask<T> task)
DistributedExecutorServicesubmit in interface DistributedExecutorServicetarget - address of Infinispan node selected for execution of the tasktask - a task to execute on selected Infinispan nodepublic <T,K> CompletableFuture<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 DistributedCallablepublic <T,K> CompletableFuture<T> submit(DistributedTask<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 DistributedTask to execute across Infinispan clusterinput - input keys for this task, effective if and only if task's callable is instance of
DistributedCallablepublic <T> List<CompletableFuture<T>> submitEverywhere(Callable<T> task)
DistributedExecutorServicesubmitEverywhere in interface DistributedExecutorServicetask - a task to execute across Infinispan clusterpublic <T> List<CompletableFuture<T>> submitEverywhere(DistributedTask<T> task)
DistributedExecutorServicesubmitEverywhere in interface DistributedExecutorServicetask - a task to execute across Infinispan clusterpublic <T,K> List<CompletableFuture<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 DistributedCallablepublic <T,K> List<CompletableFuture<T>> submitEverywhere(DistributedTask<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 DistributedCallableprotected <T,K> org.infinispan.distexec.DefaultExecutorService.DistributedTaskPart<T> createDistributedTaskPart(DistributedTask<T> task, DistributedExecuteCommand<T> c, List<K> inputKeys, Address target, int failoverCount)
protected <T,K> org.infinispan.distexec.DefaultExecutorService.DistributedTaskPart<T> createDistributedTaskPart(DistributedTask<T> task, DistributedExecuteCommand<T> c, Address target, int failoverCount)
protected <T> Address selectExecutionNode(DistributedTask<T> task)
protected List<Address> randomClusterMembers(List<Address> members, int numNeeded)
protected <K> Map<Address,List<K>> keysToExecutionNodes(DistributedTaskExecutionPolicy policy, K... input)
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.