Interface IExecutorService

  • All Superinterfaces:
    DistributedObject, java.util.concurrent.Executor, java.util.concurrent.ExecutorService

    public interface IExecutorService
    extends java.util.concurrent.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:
    ExecutorService, ExecutionCallback, MultiExecutionCallback
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void execute​(java.lang.Runnable command, MemberSelector memberSelector)
      Executes a task on a randomly selected member.
      void executeOnAllMembers​(java.lang.Runnable command)
      Executes a task on all of the known cluster members.
      void executeOnKeyOwner​(java.lang.Runnable command, java.lang.Object key)
      Executes a task on the owner of the specified key.
      void executeOnMember​(java.lang.Runnable command, Member member)
      Executes a task on the specified member.
      void executeOnMembers​(java.lang.Runnable command, MemberSelector memberSelector)
      Executes a task on each of the selected members.
      void executeOnMembers​(java.lang.Runnable command, java.util.Collection<Member> members)
      Executes a task on each of the specified members.
      LocalExecutorStats getLocalExecutorStats()
      Returns local statistics related to this executor service.
      <T> void submit​(java.lang.Runnable task, MemberSelector memberSelector, ExecutionCallback<T> callback)
      Submits a task to randomly selected members.
      <T> void submit​(java.lang.Runnable task, ExecutionCallback<T> callback)
      Submits a task to a random member.
      <T> java.util.concurrent.Future<T> submit​(java.util.concurrent.Callable<T> task, MemberSelector memberSelector)
      Submits a task to a randomly selected member and returns a Future representing that task.
      <T> void submit​(java.util.concurrent.Callable<T> task, MemberSelector memberSelector, ExecutionCallback<T> callback)
      Submits task to a randomly selected member.
      <T> void submit​(java.util.concurrent.Callable<T> task, ExecutionCallback<T> callback)
      Submits a task to a random member.
      void submitToAllMembers​(java.lang.Runnable task, MultiExecutionCallback callback)
      Submits task to all the cluster members.
      <T> java.util.Map<Member,​java.util.concurrent.Future<T>> submitToAllMembers​(java.util.concurrent.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​(java.util.concurrent.Callable<T> task, MultiExecutionCallback callback)
      Submits task to all the cluster members.
      <T> void submitToKeyOwner​(java.lang.Runnable task, java.lang.Object key, ExecutionCallback<T> callback)
      Submits a task to the owner of the specified key.
      <T> java.util.concurrent.Future<T> submitToKeyOwner​(java.util.concurrent.Callable<T> task, java.lang.Object key)
      Submits a task to the owner of the specified key and returns a Future representing that task.
      <T> void submitToKeyOwner​(java.util.concurrent.Callable<T> task, java.lang.Object key, ExecutionCallback<T> callback)
      Submits task to the owner of the specified key.
      <T> void submitToMember​(java.lang.Runnable task, Member member, ExecutionCallback<T> callback)
      Submits a task to the specified member.
      <T> java.util.concurrent.Future<T> submitToMember​(java.util.concurrent.Callable<T> task, Member member)
      Submits a task to the specified member and returns a Future representing that task.
      <T> void submitToMember​(java.util.concurrent.Callable<T> task, Member member, ExecutionCallback<T> callback)
      Submits a task to the specified member.
      void submitToMembers​(java.lang.Runnable task, MemberSelector memberSelector, MultiExecutionCallback callback)
      Submits task to the selected members.
      void submitToMembers​(java.lang.Runnable task, java.util.Collection<Member> members, MultiExecutionCallback callback)
      Submits a task to the specified members.
      <T> java.util.Map<Member,​java.util.concurrent.Future<T>> submitToMembers​(java.util.concurrent.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​(java.util.concurrent.Callable<T> task, MemberSelector memberSelector, MultiExecutionCallback callback)
      Submits task to the selected members.
      <T> java.util.Map<Member,​java.util.concurrent.Future<T>> submitToMembers​(java.util.concurrent.Callable<T> task, java.util.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​(java.util.concurrent.Callable<T> task, java.util.Collection<Member> members, MultiExecutionCallback callback)
      Submits a task to the specified members.
      • Methods inherited from interface java.util.concurrent.Executor

        execute
      • Methods inherited from interface java.util.concurrent.ExecutorService

        awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
    • Method Detail

      • execute

        void execute​(@Nonnull
                     java.lang.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:
        java.util.concurrent.RejectedExecutionException - if no member is selected
      • executeOnKeyOwner

        void executeOnKeyOwner​(@Nonnull
                               java.lang.Runnable command,
                               @Nonnull
                               java.lang.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
                             java.lang.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
                              java.lang.Runnable command,
                              @Nonnull
                              java.util.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
                              java.lang.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:
        java.util.concurrent.RejectedExecutionException - if no member is selected
      • executeOnAllMembers

        void executeOnAllMembers​(@Nonnull
                                 java.lang.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> java.util.concurrent.Future<T> submit​(@Nonnull
                                                  java.util.concurrent.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:
        java.util.concurrent.RejectedExecutionException - if no member is selected
      • submitToKeyOwner

        <T> java.util.concurrent.Future<T> submitToKeyOwner​(@Nonnull
                                                            java.util.concurrent.Callable<T> task,
                                                            @Nonnull
                                                            java.lang.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> java.util.concurrent.Future<T> submitToMember​(@Nonnull
                                                          java.util.concurrent.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> java.util.Map<Member,​java.util.concurrent.Future<T>> submitToMembers​(@Nonnull
                                                                                       java.util.concurrent.Callable<T> task,
                                                                                       @Nonnull
                                                                                       java.util.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> java.util.Map<Member,​java.util.concurrent.Future<T>> submitToMembers​(@Nonnull
                                                                                       java.util.concurrent.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:
        java.util.concurrent.RejectedExecutionException - if no member is selected
      • submitToAllMembers

        <T> java.util.Map<Member,​java.util.concurrent.Future<T>> submitToAllMembers​(@Nonnull
                                                                                          java.util.concurrent.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
                        java.lang.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:
        java.util.concurrent.RejectedExecutionException - if no member is selected
      • submitToKeyOwner

        <T> void submitToKeyOwner​(@Nonnull
                                  java.lang.Runnable task,
                                  @Nonnull
                                  java.lang.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
      • submit

        <T> void submit​(@Nonnull
                        java.util.concurrent.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:
        java.util.concurrent.RejectedExecutionException - if no member is selected
      • submitToKeyOwner

        <T> void submitToKeyOwner​(@Nonnull
                                  java.util.concurrent.Callable<T> task,
                                  @Nonnull
                                  java.lang.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
                                java.util.concurrent.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
                                 java.util.concurrent.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:
        java.util.concurrent.RejectedExecutionException - if no member is selected
      • getLocalExecutorStats

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