Interface ExecutionManager
-
- All Known Implementing Classes:
BasicExecutionEngine
public interface ExecutionManagerCentral manager for all asynchronous and scheduled tasks
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidexecuteOnce(java.lang.Runnable command)Executes a runnable one time as soon as possible.voidexecuteOnce(java.lang.Runnable command, long delay)Excutes a runnable one time after a delay, specified in millisecondsjava.util.concurrent.ScheduledFuture<?>executeOnce(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)Executes the runnable once, after the specified delay.voidregister(java.lang.String owner, java.lang.String name, SelfSchedulingRunnable command)Registers a self scheduling command to be executed.voidregister(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rateMS)Registers a command to be executing repeatedly at the specified rate.voidregister(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit)Registers a command to be executing repeatedly at the specified rate.voidregisterAtFixedRate(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit)Registers a command to be executed with a fixed rate rather than a fixed delay.voidregisterAtFixedRateWithInitialDelay(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit, int initialDelay)Registers a command to be executed with a fixed rate after some initial delay.voidregisterWithInitialDelay(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, int initialDelay)Registers a command to be executing repeatedly at the specified rate with an initial delay.voidregisterWithInitialDelay(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit, int initialDelay)Registers a command to be executing repeatedly at the specified rate with an initial delay.java.util.concurrent.ScheduledFuture<?>scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)Schedules a runnable to execute with a fixed delay, and after an initial delay, much likeregisterWithInitialDelay(String, String, Runnable, int, TimeUnit, int).voidshutdown()Stops all execution gracefully.voidunRegister(java.lang.String owner, java.lang.String name)Unregisters a given command.default voidunRegister(java.lang.String owner, java.lang.String name, boolean interrupt)Unregisters a given command.voidunRegisterAll(java.lang.String owner)Unregisters all commands for the given owner.
-
-
-
Method Detail
-
register
void register(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rateMS)Registers a command to be executing repeatedly at the specified rate. If the name is already registered, the existing execution unit will be modified.- Parameters:
owner- name of the "owner"- just a string qualifier for the command name.name- identifier used in conjunction with the owner to identify the command.command- Runnable to be called at the specified rate.rateMS- The amount of time to wait in between invocations of the command, in milliseconds.
-
register
void register(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit)Registers a command to be executing repeatedly at the specified rate. If the name is already registered, the existing execution unit will be modified.- Parameters:
owner- name of the "owner"- just a string qualifier for the command name.name- identifier used in conjunction with the owner to identify the command.command- Runnable to be called at the specified rate.
-
register
void register(java.lang.String owner, java.lang.String name, SelfSchedulingRunnable command)Registers a self scheduling command to be executed. Self scheduling commands provide their own execution delay, which can change from exec to exec.
-
registerWithInitialDelay
void registerWithInitialDelay(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, int initialDelay)Registers a command to be executing repeatedly at the specified rate with an initial delay.
-
registerWithInitialDelay
void registerWithInitialDelay(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit, int initialDelay)Registers a command to be executing repeatedly at the specified rate with an initial delay.
-
registerAtFixedRate
void registerAtFixedRate(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit)Registers a command to be executed with a fixed rate rather than a fixed delay.
-
registerAtFixedRateWithInitialDelay
void registerAtFixedRateWithInitialDelay(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit, int initialDelay)Registers a command to be executed with a fixed rate after some initial delay.
-
executeOnce
void executeOnce(java.lang.Runnable command)
Executes a runnable one time as soon as possible.
-
executeOnce
void executeOnce(java.lang.Runnable command, long delay)Excutes a runnable one time after a delay, specified in milliseconds
-
executeOnce
java.util.concurrent.ScheduledFuture<?> executeOnce(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)Executes the runnable once, after the specified delay. Basically passes the runnable directly to the underlying ScheduledExecutorService. The returned ScheduledFuture can be used to track/cancel the execution.
-
scheduleWithFixedDelay
java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)Schedules a runnable to execute with a fixed delay, and after an initial delay, much likeregisterWithInitialDelay(String, String, Runnable, int, TimeUnit, int). The difference is that this method returns a ScheduledFuture that can be used to cancel the task.
-
unRegister
void unRegister(java.lang.String owner, java.lang.String name)Unregisters a given command. If it is in the process of executing, it will be interrupted.
-
unRegister
default void unRegister(java.lang.String owner, java.lang.String name, boolean interrupt)Unregisters a given command. Default implementation will interrupt if it is in the process of executing.- Parameters:
interrupt- Interrupts the execution if it is currently occurring. If false, waits for completion.
-
unRegisterAll
void unRegisterAll(java.lang.String owner)
Unregisters all commands for the given owner.
-
shutdown
void shutdown()
Stops all execution gracefully.
-
-