Package com.hazelcast.core
Interface IExecutorService
- All Superinterfaces:
DistributedObject
,Executor
,ExecutorService
Distributed implementation of
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.-
Method Summary
Modifier and TypeMethodDescriptionvoid
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, MemberSelector memberSelector) Executes a task on each of the selected members.void
executeOnMembers
(Runnable command, Collection<Member> members) Executes a task on each of the specified members.<T> void
submit
(Runnable task, MemberSelector memberSelector, ExecutionCallback<T> callback) Submits a task to randomly selected members.<T> void
submit
(Runnable 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
(Callable<T> task, ExecutionCallback<T> callback) Submits a task to a random member.void
submitToAllMembers
(Runnable task, MultiExecutionCallback callback) Submits task to all the cluster members.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.<T> void
submitToKeyOwner
(Runnable task, Object key, ExecutionCallback<T> callback) Submits a task to the owner of the specified key.<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
submitToMember
(Runnable task, Member member, ExecutionCallback<T> callback) Submits a task to the specified member.<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.void
submitToMembers
(Runnable task, MemberSelector memberSelector, MultiExecutionCallback callback) Submits task to all the cluster members.void
submitToMembers
(Runnable task, Collection<Member> members, MultiExecutionCallback callback) Submits task to the selected members.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.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.Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getName, getPartitionKey, getServiceName
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
-
Method Details
-
execute
Executes a task on a randomly selected member.- Parameters:
command
- the task that is executed on a randomly selected membermemberSelector
- memberSelector- Throws:
RejectedExecutionException
- if no member is selected
-
executeOnKeyOwner
Executes a task on the owner of the specified key.- Parameters:
command
- a task executed on the owner of the specified keykey
- the specified key
-
executeOnMember
Executes a task on the specified member.- Parameters:
command
- the task executed on the specified membermember
- the specified member
-
executeOnMembers
Executes a task on each of the specified members.- Parameters:
command
- the task executed on the specified membersmembers
- the specified members
-
executeOnMembers
Executes a task on each of the selected members.- Parameters:
command
- a task executed on each of the selected membersmemberSelector
- memberSelector- Throws:
RejectedExecutionException
- if no member is selected
-
executeOnAllMembers
Executes a task on all of the known cluster members.- Parameters:
command
- a task executed on all of the known cluster members
-
submit
Submits a task to a randomly selected member and returns a Future representing that task.- Type Parameters:
T
- the result type of callable- Parameters:
task
- task submitted to a randomly selected membermemberSelector
- memberSelector- Returns:
- a Future representing pending completion of the task
- Throws:
RejectedExecutionException
- if no member is selected
-
submitToKeyOwner
Submits a task to the owner of the specified key and returns a Future representing that task.- Type Parameters:
T
- the result type of callable- Parameters:
task
- task submitted to the owner of the specified keykey
- the specified key- Returns:
- a Future representing pending completion of the task
-
submitToMember
Submits a task to the specified member and returns a Future representing that task.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to the specified membermember
- the specified member- Returns:
- a Future representing pending completion of the task
-
submitToMembers
<T> Map<Member,Future<T>> submitToMembers(@Nonnull Callable<T> task, @Nonnull 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- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to given membersmembers
- the given members- Returns:
- map of Member-Future pairs representing pending completion of the task on each member
-
submitToMembers
<T> Map<Member,Future<T>> submitToMembers(@Nonnull Callable<T> task, @Nonnull 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.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to selected membersmemberSelector
- memberSelector- Returns:
- map of Member-Future pairs representing pending completion of the task on each member
- Throws:
RejectedExecutionException
- if no member is selected
-
submitToAllMembers
Submits task to all cluster members and returns a map of Member-Future pairs representing pending completion of the task on each member.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to all cluster members- Returns:
- map of Member-Future pairs representing pending completion of the task on each member
-
submit
Submits a task to a random member. Caller will be notified of the result of the task byExecutionCallback.onResponse(Object)
orExecutionCallback.onFailure(Throwable)
.- Type Parameters:
T
- the response type of callback- Parameters:
task
- a task submitted to a random membercallback
- callback
-
submit
<T> void submit(@Nonnull Runnable task, @Nonnull MemberSelector memberSelector, @Nullable ExecutionCallback<T> callback) Submits a task to randomly selected members. Caller will be notified for the result of the task byExecutionCallback.onResponse(Object)
orExecutionCallback.onFailure(Throwable)
.- Type Parameters:
T
- the response type of callback- Parameters:
task
- the task submitted to randomly selected membersmemberSelector
- memberSelectorcallback
- callback- Throws:
RejectedExecutionException
- if no member is selected
-
submitToKeyOwner
<T> void submitToKeyOwner(@Nonnull Runnable task, @Nonnull Object key, @Nonnull ExecutionCallback<T> callback) Submits a task to the owner of the specified key. Caller will be notified for the result of the task byExecutionCallback.onResponse(Object)
orExecutionCallback.onFailure(Throwable)
.- Type Parameters:
T
- the response type of callback- Parameters:
task
- task submitted to the owner of the specified keykey
- the specified keycallback
- callback
-
submitToMember
<T> void submitToMember(@Nonnull Runnable task, @Nonnull Member member, @Nullable ExecutionCallback<T> callback) Submits a task to the specified member. Caller will be notified for the result of the task byExecutionCallback.onResponse(Object)
orExecutionCallback.onFailure(Throwable)
.- Type Parameters:
T
- the response type of callback- Parameters:
task
- the task submitted to the specified membermember
- the specified membercallback
- callback
-
submitToMembers
void submitToMembers(@Nonnull Runnable task, @Nonnull Collection<Member> members, @Nonnull MultiExecutionCallback callback) Submits task to the selected members. Caller will be notified for the result of each task byMultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,MultiExecutionCallback.onComplete(Map)
will be called.- Parameters:
task
- the task submitted to the specified membersmembers
- the specified memberscallback
- callback
-
submitToMembers
void submitToMembers(@Nonnull Runnable task, @Nonnull MemberSelector memberSelector, @Nonnull MultiExecutionCallback callback) Submits task to all the cluster members. Caller will be notified for the result of each task byMultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,MultiExecutionCallback.onComplete(Map)
will be called.- Parameters:
task
- the task submitted to the selected membersmemberSelector
- memberSelectorcallback
- callback- Throws:
RejectedExecutionException
- if no member is selected
-
submitToAllMembers
Submits task to all the cluster members. Caller will be notified for the result of each task byMultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,MultiExecutionCallback.onComplete(Map)
will be called.- Parameters:
task
- the task submitted to all the cluster memberscallback
- callback
-
submit
Submits a task to a random member. Caller will be notified for the result of the task byExecutionCallback.onResponse(Object)
orExecutionCallback.onFailure(Throwable)
.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to a random membercallback
- callback
-
submit
<T> void submit(@Nonnull Callable<T> task, @Nonnull MemberSelector memberSelector, @Nullable ExecutionCallback<T> callback) Submits task to a randomly selected member. Caller will be notified for the result of the task byExecutionCallback.onResponse(Object)
orExecutionCallback.onFailure(Throwable)
.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to a randomly selected membermemberSelector
- memberSelectorcallback
- callback- Throws:
RejectedExecutionException
- if no member is selected
-
submitToKeyOwner
<T> void submitToKeyOwner(@Nonnull Callable<T> task, @Nonnull Object key, @Nullable ExecutionCallback<T> callback) Submits task to the owner of the specified key. Caller will be notified for the result of the task byExecutionCallback.onResponse(Object)
orExecutionCallback.onFailure(Throwable)
.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to the owner of the specified keykey
- the specified keycallback
- callback
-
submitToMember
<T> void submitToMember(@Nonnull Callable<T> task, @Nonnull Member member, @Nullable ExecutionCallback<T> callback) Submits a task to the specified member. Caller will be notified for the result of the task byExecutionCallback.onResponse(Object)
orExecutionCallback.onFailure(Throwable)
.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to the specified membermember
- the specified membercallback
- callback
-
submitToMembers
<T> void submitToMembers(@Nonnull Callable<T> task, @Nonnull Collection<Member> members, @Nonnull MultiExecutionCallback callback) Submits a task to the specified members. Caller will be notified for the result of each task by { MultiExecutionCallback#onResponse(Member, Object)}, and when all tasks are completed, { MultiExecutionCallback#onComplete(Map)} will be called.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to the specified membersmembers
- the specified memberscallback
- callback
-
submitToMembers
<T> void submitToMembers(@Nonnull Callable<T> task, @Nonnull MemberSelector memberSelector, @Nonnull MultiExecutionCallback callback) Submits task to the selected members. Caller will be notified for the result of each task byMultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,MultiExecutionCallback.onComplete(Map)
will be called.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to the selected membersmemberSelector
- memberSelectorcallback
- callback- Throws:
RejectedExecutionException
- if no member is selected
-
submitToAllMembers
Submits task to all the cluster members. Caller will be notified for the result of each task byMultiExecutionCallback.onResponse(Member, Object)
, and when all tasks are completed,MultiExecutionCallback.onComplete(Map)
will be called.- Type Parameters:
T
- the result type of callable- Parameters:
task
- the task submitted to all the cluster memberscallback
- callback
-