public interface IExecutorService extends ExecutorService, DistributedObject
ExecutorService
.
IExecutorService provides additional methods like executing tasks
on a specific member, on a member who is owner of a specific key,
executing a tasks on multiple members and listening execution result using a callback.
Supports split brain protection SplitBrainProtectionConfig
since 3.10 in cluster
versions 3.10 and higher.ExecutorService
,
ExecutionCallback
,
MultiExecutionCallback
Modifier and Type | Method and Description |
---|---|
void |
execute(Runnable command,
MemberSelector memberSelector)
Executes a task on a randomly selected member.
|
void |
executeOnAllMembers(Runnable command)
Executes a task on all of the known cluster members.
|
void |
executeOnKeyOwner(Runnable command,
Object key)
Executes a task on the owner of the specified key.
|
void |
executeOnMember(Runnable command,
Member member)
Executes a task on the specified member.
|
void |
executeOnMembers(Runnable command,
Collection<Member> members)
Executes a task on each of the specified members.
|
void |
executeOnMembers(Runnable command,
MemberSelector memberSelector)
Executes a task on each of the selected members.
|
LocalExecutorStats |
getLocalExecutorStats()
Returns local statistics related to this executor service.
|
<T> void |
submit(Callable<T> task,
ExecutionCallback<T> callback)
Submits a task to a random member.
|
<T> Future<T> |
submit(Callable<T> task,
MemberSelector memberSelector)
Submits a task to a randomly selected member and returns a Future
representing that task.
|
<T> void |
submit(Callable<T> task,
MemberSelector memberSelector,
ExecutionCallback<T> callback)
Submits task to a randomly selected member.
|
<T> void |
submit(Runnable task,
ExecutionCallback<T> callback)
Submits a task to a random member.
|
<T> void |
submit(Runnable task,
MemberSelector memberSelector,
ExecutionCallback<T> callback)
Submits a task to randomly selected members.
|
<T> Map<Member,Future<T>> |
submitToAllMembers(Callable<T> task)
Submits task to all cluster members and returns a
map of Member-Future pairs representing pending completion of the task on each member.
|
<T> void |
submitToAllMembers(Callable<T> task,
MultiExecutionCallback callback)
Submits task to all the cluster members.
|
void |
submitToAllMembers(Runnable task,
MultiExecutionCallback callback)
Submits task to all the cluster members.
|
<T> Future<T> |
submitToKeyOwner(Callable<T> task,
Object key)
Submits a task to the owner of the specified key and returns a Future
representing that task.
|
<T> void |
submitToKeyOwner(Callable<T> task,
Object key,
ExecutionCallback<T> callback)
Submits task to the owner of the specified key.
|
<T> void |
submitToKeyOwner(Runnable task,
Object key,
ExecutionCallback<T> callback)
Submits a task to the owner of the specified key.
|
<T> Future<T> |
submitToMember(Callable<T> task,
Member member)
Submits a task to the specified member and returns a Future
representing that task.
|
<T> void |
submitToMember(Callable<T> task,
Member member,
ExecutionCallback<T> callback)
Submits a task to the specified member.
|
<T> void |
submitToMember(Runnable task,
Member member,
ExecutionCallback<T> callback)
Submits a task to the specified member.
|
<T> Map<Member,Future<T>> |
submitToMembers(Callable<T> task,
Collection<Member> members)
Submits a task to given members and returns
map of Member-Future pairs representing pending completion of the task on each member
|
<T> void |
submitToMembers(Callable<T> task,
Collection<Member> members,
MultiExecutionCallback callback)
Submits a task to the specified members.
|
<T> Map<Member,Future<T>> |
submitToMembers(Callable<T> task,
MemberSelector memberSelector)
Submits a task to selected members and returns a
map of Member-Future pairs representing pending completion of the task on each member.
|
<T> void |
submitToMembers(Callable<T> task,
MemberSelector memberSelector,
MultiExecutionCallback callback)
Submits task to the selected members.
|
void |
submitToMembers(Runnable task,
Collection<Member> members,
MultiExecutionCallback callback)
Submits a task to the specified members.
|
void |
submitToMembers(Runnable task,
MemberSelector memberSelector,
MultiExecutionCallback callback)
Submits task to the selected members.
|
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
destroy, getName, getPartitionKey, getServiceName
void execute(@Nonnull Runnable command, @Nonnull MemberSelector memberSelector)
command
- the task that is executed on a randomly selected membermemberSelector
- memberSelectorRejectedExecutionException
- if no member is selectedvoid executeOnKeyOwner(@Nonnull Runnable command, @Nonnull Object key)
command
- a task executed on the owner of the specified keykey
- the specified keyvoid executeOnMember(@Nonnull Runnable command, @Nonnull Member member)
command
- the task executed on the specified membermember
- the specified membervoid executeOnMembers(@Nonnull Runnable command, @Nonnull Collection<Member> members)
command
- the task executed on the specified membersmembers
- the specified membersvoid executeOnMembers(@Nonnull Runnable command, @Nonnull MemberSelector memberSelector)
command
- a task executed on each of the selected membersmemberSelector
- memberSelectorRejectedExecutionException
- if no member is selectedvoid executeOnAllMembers(@Nonnull Runnable command)
command
- a task executed on all of the known cluster members<T> Future<T> submit(@Nonnull Callable<T> task, @Nonnull MemberSelector memberSelector)
T
- the result type of callabletask
- task submitted to a randomly selected membermemberSelector
- memberSelectorRejectedExecutionException
- if no member is selected<T> Future<T> submitToKeyOwner(@Nonnull Callable<T> task, @Nonnull Object key)
T
- the result type of callabletask
- task submitted to the owner of the specified keykey
- the specified key<T> Future<T> submitToMember(@Nonnull Callable<T> task, @Nonnull Member member)
T
- the result type of callabletask
- the task submitted to the specified membermember
- the specified member<T> Map<Member,Future<T>> submitToMembers(@Nonnull Callable<T> task, @Nonnull Collection<Member> members)
T
- the result type of callabletask
- the task submitted to given membersmembers
- the given members<T> Map<Member,Future<T>> submitToMembers(@Nonnull Callable<T> task, @Nonnull MemberSelector memberSelector)
T
- the result type of callabletask
- the task submitted to selected membersmemberSelector
- memberSelectorRejectedExecutionException
- if no member is selected<T> Map<Member,Future<T>> submitToAllMembers(@Nonnull Callable<T> task)
T
- the result type of callabletask
- the task submitted to all cluster members<T> void submit(@Nonnull Runnable task, @Nullable ExecutionCallback<T> callback)
ExecutionCallback.onResponse(Object)
or ExecutionCallback.onFailure(Throwable)
.T
- the response type of callbacktask
- a task submitted to a random membercallback
- callback<T> void submit(@Nonnull Runnable task, @Nonnull MemberSelector memberSelector, @Nullable ExecutionCallback<T> callback)
ExecutionCallback.onResponse(Object)
or ExecutionCallback.onFailure(Throwable)
.T
- the response type of callbacktask
- the task submitted to randomly selected membersmemberSelector
- memberSelectorcallback
- callbackRejectedExecutionException
- if no member is selected<T> void submitToKeyOwner(@Nonnull Runnable task, @Nonnull Object key, @Nonnull ExecutionCallback<T> callback)
ExecutionCallback.onResponse(Object)
or ExecutionCallback.onFailure(Throwable)
.T
- the response type of callbacktask
- task submitted to the owner of the specified keykey
- the specified keycallback
- callback<T> void submitToMember(@Nonnull Runnable task, @Nonnull Member member, @Nullable ExecutionCallback<T> callback)
ExecutionCallback.onResponse(Object)
or ExecutionCallback.onFailure(Throwable)
.T
- the response type of callbacktask
- the task submitted to the specified membermember
- the specified membercallback
- callbackvoid submitToMembers(@Nonnull Runnable task, @Nonnull Collection<Member> members, @Nonnull MultiExecutionCallback callback)
MultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,
MultiExecutionCallback.onComplete(java.util.Map)
will be called.task
- the task submitted to the specified membersmembers
- the specified memberscallback
- callbackvoid submitToMembers(@Nonnull Runnable task, @Nonnull MemberSelector memberSelector, @Nonnull MultiExecutionCallback callback)
MultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,
MultiExecutionCallback.onComplete(java.util.Map)
will be called.task
- the task submitted to the selected membersmemberSelector
- memberSelectorcallback
- callbackRejectedExecutionException
- if no member is selectedvoid submitToAllMembers(@Nonnull Runnable task, @Nonnull MultiExecutionCallback callback)
MultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,
MultiExecutionCallback.onComplete(java.util.Map)
will be called.task
- the task submitted to all the cluster memberscallback
- callback<T> void submit(@Nonnull Callable<T> task, @Nullable ExecutionCallback<T> callback)
ExecutionCallback.onResponse(Object)
or ExecutionCallback.onFailure(Throwable)
.T
- the result type of callabletask
- the task submitted to a random membercallback
- callback<T> void submit(@Nonnull Callable<T> task, @Nonnull MemberSelector memberSelector, @Nullable ExecutionCallback<T> callback)
ExecutionCallback.onResponse(Object)
or ExecutionCallback.onFailure(Throwable)
.T
- the result type of callabletask
- the task submitted to a randomly selected membermemberSelector
- memberSelectorcallback
- callbackRejectedExecutionException
- if no member is selected<T> void submitToKeyOwner(@Nonnull Callable<T> task, @Nonnull Object key, @Nullable ExecutionCallback<T> callback)
ExecutionCallback.onResponse(Object)
or ExecutionCallback.onFailure(Throwable)
.T
- the result type of callabletask
- the task submitted to the owner of the specified keykey
- the specified keycallback
- callback<T> void submitToMember(@Nonnull Callable<T> task, @Nonnull Member member, @Nullable ExecutionCallback<T> callback)
ExecutionCallback.onResponse(Object)
or ExecutionCallback.onFailure(Throwable)
.T
- the result type of callabletask
- the task submitted to the specified membermember
- the specified membercallback
- callback<T> void submitToMembers(@Nonnull Callable<T> task, @Nonnull Collection<Member> members, @Nonnull MultiExecutionCallback callback)
MultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,
MultiExecutionCallback.onComplete(java.util.Map)
will be called.T
- the result type of callabletask
- the task submitted to the specified membersmembers
- the specified memberscallback
- callback<T> void submitToMembers(@Nonnull Callable<T> task, @Nonnull MemberSelector memberSelector, @Nonnull MultiExecutionCallback callback)
MultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,
MultiExecutionCallback.onComplete(java.util.Map)
will be called.T
- the result type of callabletask
- the task submitted to the selected membersmemberSelector
- memberSelectorcallback
- callbackRejectedExecutionException
- if no member is selected<T> void submitToAllMembers(@Nonnull Callable<T> task, @Nonnull MultiExecutionCallback callback)
MultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,
MultiExecutionCallback.onComplete(java.util.Map)
will be called.T
- the result type of callabletask
- the task submitted to all the cluster memberscallback
- callbackLocalExecutorStats getLocalExecutorStats()
Copyright © 2022 Hazelcast, Inc.. All rights reserved.