Package fish.payara.nucleus.exec
Class ClusterExecutionService
- java.lang.Object
-
- fish.payara.nucleus.exec.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.api.event.EventListener
EventListener.Event<T>
-
-
Constructor Summary
Constructors Constructor Description ClusterExecutionService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevent(EventListener.Event event)Process a Glassfish/Payara eventvoidpostConstruct()<T extends Serializable>
Future<T>runCallable(String memberUUID, Callable<T> callable)Runs a Callable object on the specified Member<T extends Serializable>
Map<UUID,Future<T>>runCallable(Collection<UUID> memberUUIDS, Callable<T> callable)Runs a Callable object on a set of members<T extends Serializable>
Future<T>runCallable(Callable<T> callable)Runs a Callable object<T extends Serializable>
Map<UUID,Future<T>>runCallableAllMembers(Callable<T> callable)Runs a Callable on All members of the cluster<V extends Serializable>
ScheduledTaskFuture<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<V extends Serializable>
Map<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<V extends Serializable>
ScheduledTaskFuture<V>schedule(Callable<V> callable, long delay, TimeUnit unit)Schedules a Callable object to be run in the futureScheduledTaskFuture<? extends Serializable>scheduleAtFixedRate(Runnable runnable, long delay, long period, TimeUnit unit)Schedules a Callable object to be run in the futureScheduledTaskFuture<?>scheduleAtFixedRate(String memberUUID, Runnable runnable, long delay, long period, TimeUnit unit)Schedules a Callable object to be run in the future on the specified MemberMap<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
-
-
-
Method Detail
-
postConstruct
@PostConstruct public void postConstruct()
-
runCallable
public <T extends Serializable> Future<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 Serializable> Future<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 oncallable- The Callable object- Returns:
- Future for the result
-
runCallable
public <T extends Serializable> Map<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 oncallable- The Callable to run- Returns:
- A map of Futures keyed by Member UUID
-
runCallableAllMembers
public <T extends Serializable> Map<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 Serializable> ScheduledTaskFuture<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 Objectdelay- The delay before running the taskunit- The time unit of the delay- Returns:
- A Future containing the result
-
schedule
public <V extends Serializable> ScheduledTaskFuture<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 oncallable- The Callable Objectdelay- The delay before running the taskunit- The time unit of the delay- Returns:
- A Future containing the result
-
schedule
public <V extends Serializable> Map<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 oncallable- The Callable Objectdelay- The delay before running the taskunit- 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 Objectdelay- The delay before running the taskperiod- The period for the fixed rateunit- 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 onrunnable- The Runnable Objectdelay- The delay before running the taskperiod- The period for the fixed rateunit- 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 onrunnable- The Runnable Objectdelay- The delay before running the taskperiod- The period of the fixed rateunit- The time unit of the delay- Returns:
- A Future containing the result
-
event
public void event(EventListener.Event event)
Description copied from interface:EventListenerProcess a Glassfish/Payara event- Specified by:
eventin interfaceEventListener
-
-