Class ClusterExecutionService

  • All Implemented Interfaces:
    EventListener

    @Service(name="payara-cluster-executor")
    @RunLevel(10)
    public class ClusterExecutionService
    extends Object
    implements EventListener
    Execution Service for running Callables across the Payara Cluster also enables Scheduling of Callables to run on the cluster.
    Author:
    steve
    • Constructor Detail

      • ClusterExecutionService

        public ClusterExecutionService()
    • Method Detail

      • postConstruct

        @PostConstruct
        public void postConstruct()
      • runCallable

        public <T extends SerializableFuture<T> runCallable​(Callable<T> callable)
        Runs a Callable object
        Type Parameters:
        T - Type of the Callable Result
        Parameters:
        callable - The Callable object
        Returns:
        Future for the result
      • runCallable

        public <T extends SerializableFuture<T> runCallable​(String memberUUID,
                                                              Callable<T> callable)
        Runs a Callable object on the specified Member
        Type Parameters:
        T - Type of the Callable Result
        Parameters:
        memberUUID - The member to run the Callable on
        callable - The Callable object
        Returns:
        Future for the result
      • runCallable

        public <T extends SerializableMap<UUID,​Future<T>> runCallable​(Collection<UUID> memberUUIDS,
                                                                              Callable<T> callable)
        Runs a Callable object on a set of members
        Type Parameters:
        T - The type of the Callable result
        Parameters:
        memberUUIDS - A set of members to run the Callables on
        callable - The Callable to run
        Returns:
        A map of Futures keyed by Member UUID
      • runCallableAllMembers

        public <T extends SerializableMap<UUID,​Future<T>> runCallableAllMembers​(Callable<T> callable)
        Runs a Callable on All members of the cluster
        Type Parameters:
        T - The result of the Callable
        Parameters:
        callable - The Callable to run
        Returns:
        A Map of Future results keyed by member UUID
      • schedule

        public <V extends SerializableScheduledTaskFuture<V> schedule​(Callable<V> callable,
                                                                        long delay,
                                                                        TimeUnit unit)
        Schedules a Callable object to be run in the future
        Type Parameters:
        V - The type of the result
        Parameters:
        callable - The Callable Object
        delay - The delay before running the task
        unit - The time unit of the delay
        Returns:
        A Future containing the result
      • schedule

        public <V extends SerializableScheduledTaskFuture<V> schedule​(String memberUUID,
                                                                        Callable<V> callable,
                                                                        long delay,
                                                                        TimeUnit unit)
        Schedules a Callable object to be run in the future on the specified Member
        Type Parameters:
        V - The type of the result
        Parameters:
        memberUUID - The member to schedule the task on
        callable - The Callable Object
        delay - The delay before running the task
        unit - The time unit of the delay
        Returns:
        A Future containing the result
      • schedule

        public <V extends SerializableMap<UUID,​ScheduledTaskFuture<V>> schedule​(Collection<UUID> memberUUIDs,
                                                                                        Callable<V> callable,
                                                                                        long delay,
                                                                                        TimeUnit unit)
        Schedules a Callable object to be run in the future on the specified Member
        Type Parameters:
        V - The type of the result
        Parameters:
        memberUUIDs - The members to schedule the task on
        callable - The Callable Object
        delay - The delay before running the task
        unit - The time unit of the delay
        Returns:
        A Future containing the result
      • scheduleAtFixedRate

        public ScheduledTaskFuture<? extends Serializable> scheduleAtFixedRate​(Runnable runnable,
                                                                               long delay,
                                                                               long period,
                                                                               TimeUnit unit)
        Schedules a Callable object to be run in the future
        Parameters:
        runnable - The Runnable Object
        delay - The delay before running the task
        period - The period for the fixed rate
        unit - The time unit of the delay
        Returns:
        A Future containing the result
      • scheduleAtFixedRate

        public ScheduledTaskFuture<?> scheduleAtFixedRate​(String memberUUID,
                                                          Runnable runnable,
                                                          long delay,
                                                          long period,
                                                          TimeUnit unit)
        Schedules a Callable object to be run in the future on the specified Member
        Parameters:
        memberUUID - The member to schedule the task on
        runnable - The Runnable Object
        delay - The delay before running the task
        period - The period for the fixed rate
        unit - The time unit of the delay
        Returns:
        A Future containing the result
      • scheduleAtFixedRate

        public Map<UUID,​ScheduledTaskFuture<?>> scheduleAtFixedRate​(Collection<UUID> memberUUIDs,
                                                                          Runnable runnable,
                                                                          long delay,
                                                                          long period,
                                                                          TimeUnit unit)
        Schedules a Callable object to be run in the future on the specified Member
        Parameters:
        memberUUIDs - The members to schedule the task on
        runnable - The Runnable Object
        delay - The delay before running the task
        period - The period of the fixed rate
        unit - The time unit of the delay
        Returns:
        A Future containing the result