Interface IExecutorService

All Superinterfaces:
DistributedObject, Executor, ExecutorService

public interface IExecutorService extends ExecutorService, DistributedObject
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.

Supports split brain protection SplitBrainProtectionConfig since 3.10 in cluster versions 3.10 and higher.

See Also:
  • Method Details

    • execute

      void execute(@Nonnull Runnable command, @Nonnull MemberSelector memberSelector)
      Executes a task on a randomly selected member.
      Parameters:
      command - the task that is executed on a randomly selected member
      memberSelector - memberSelector
      Throws:
      RejectedExecutionException - if no member is selected
    • executeOnKeyOwner

      void executeOnKeyOwner(@Nonnull Runnable command, @Nonnull Object key)
      Executes a task on the owner of the specified key.
      Parameters:
      command - a task executed on the owner of the specified key
      key - the specified key
    • executeOnMember

      void executeOnMember(@Nonnull Runnable command, @Nonnull Member member)
      Executes a task on the specified member.
      Parameters:
      command - the task executed on the specified member
      member - the specified member
    • executeOnMembers

      void executeOnMembers(@Nonnull Runnable command, @Nonnull Collection<Member> members)
      Executes a task on each of the specified members.
      Parameters:
      command - the task executed on the specified members
      members - the specified members
    • executeOnMembers

      void executeOnMembers(@Nonnull Runnable command, @Nonnull MemberSelector memberSelector)
      Executes a task on each of the selected members.
      Parameters:
      command - a task executed on each of the selected members
      memberSelector - memberSelector
      Throws:
      RejectedExecutionException - if no member is selected
    • executeOnAllMembers

      void executeOnAllMembers(@Nonnull Runnable command)
      Executes a task on all of the known cluster members.
      Parameters:
      command - a task executed on all of the known cluster members
    • submit

      <T> Future<T> submit(@Nonnull Callable<T> task, @Nonnull MemberSelector memberSelector)
      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 member
      memberSelector - memberSelector
      Returns:
      a Future representing pending completion of the task
      Throws:
      RejectedExecutionException - if no member is selected
    • submitToKeyOwner

      <T> Future<T> submitToKeyOwner(@Nonnull Callable<T> task, @Nonnull Object key)
      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 key
      key - the specified key
      Returns:
      a Future representing pending completion of the task
    • submitToMember

      <T> Future<T> submitToMember(@Nonnull Callable<T> task, @Nonnull Member member)
      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 member
      member - 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 members
      members - 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 members
      memberSelector - memberSelector
      Returns:
      map of Member-Future pairs representing pending completion of the task on each member
      Throws:
      RejectedExecutionException - if no member is selected
    • submitToAllMembers

      <T> Map<Member,Future<T>> submitToAllMembers(@Nonnull 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.
      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

      <T> void submit(@Nonnull Runnable task, @Nullable ExecutionCallback<T> callback)
      Submits a task to a random member. Caller will be notified of the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).
      Type Parameters:
      T - the response type of callback
      Parameters:
      task - a task submitted to a random member
      callback - 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 by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).
      Type Parameters:
      T - the response type of callback
      Parameters:
      task - the task submitted to randomly selected members
      memberSelector - memberSelector
      callback - 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 by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).
      Type Parameters:
      T - the response type of callback
      Parameters:
      task - task submitted to the owner of the specified key
      key - the specified key
      callback - 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 by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).
      Type Parameters:
      T - the response type of callback
      Parameters:
      task - the task submitted to the specified member
      member - the specified member
      callback - callback
    • submitToMembers

      void submitToMembers(@Nonnull Runnable 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(java.util.Map) will be called.
      Parameters:
      task - the task submitted to the specified members
      members - the specified members
      callback - callback
    • submitToMembers

      void submitToMembers(@Nonnull Runnable task, @Nonnull MemberSelector memberSelector, @Nonnull MultiExecutionCallback callback)
      Submits task to the selected members. Caller will be notified for the result of each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.
      Parameters:
      task - the task submitted to the selected members
      memberSelector - memberSelector
      callback - callback
      Throws:
      RejectedExecutionException - if no member is selected
    • submitToAllMembers

      void submitToAllMembers(@Nonnull Runnable task, @Nonnull MultiExecutionCallback callback)
      Submits task to all the cluster members. Caller will be notified for the result of each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.
      Parameters:
      task - the task submitted to all the cluster members
      callback - callback
    • submit

      <T> void submit(@Nonnull Callable<T> task, @Nullable ExecutionCallback<T> callback)
      Submits a task to a random member. Caller will be notified for the result of the task by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).
      Type Parameters:
      T - the result type of callable
      Parameters:
      task - the task submitted to a random member
      callback - 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 by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).
      Type Parameters:
      T - the result type of callable
      Parameters:
      task - the task submitted to a randomly selected member
      memberSelector - memberSelector
      callback - 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 by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).
      Type Parameters:
      T - the result type of callable
      Parameters:
      task - the task submitted to the owner of the specified key
      key - the specified key
      callback - 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 by ExecutionCallback.onResponse(Object) or ExecutionCallback.onFailure(Throwable).
      Type Parameters:
      T - the result type of callable
      Parameters:
      task - the task submitted to the specified member
      member - the specified member
      callback - 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(java.util.Map) will be called.
      Type Parameters:
      T - the result type of callable
      Parameters:
      task - the task submitted to the specified members
      members - the specified members
      callback - 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 by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.
      Type Parameters:
      T - the result type of callable
      Parameters:
      task - the task submitted to the selected members
      memberSelector - memberSelector
      callback - callback
      Throws:
      RejectedExecutionException - if no member is selected
    • submitToAllMembers

      <T> void submitToAllMembers(@Nonnull Callable<T> task, @Nonnull MultiExecutionCallback callback)
      Submits task to all the cluster members. Caller will be notified for the result of each task by MultiExecutionCallback.onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback.onComplete(java.util.Map) will be called.
      Type Parameters:
      T - the result type of callable
      Parameters:
      task - the task submitted to all the cluster members
      callback - callback
    • getLocalExecutorStats

      LocalExecutorStats getLocalExecutorStats()
      Returns local statistics related to this executor service.
      Returns:
      local statistics related to this executor service