Class BasicExecutionEngine
java.lang.Object
com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine
- All Implemented Interfaces:
- ExecutionManager
The ExecutionEngine is a wrapper around a scheduled executor service. Callers are able to create named tasks, and
 this class keeps track of associating those names with the ScheduledFutures that represent the actual execution
 tasks.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classclass
- 
Constructor SummaryConstructorsConstructorDescriptionBasicExecutionEngine(int threadCount, String name) BasicExecutionEngine(int threadCount, String name, boolean daemon) BasicExecutionEngine(int threadCount, String name, ThreadFactory threadFactory) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidexecuteOnce(Runnable command) Executes a runnable one time as soon as possible.voidexecuteOnce(Runnable command, long delay) Excutes a runnable one time after a delay, specified in millisecondsexecuteOnce(Runnable command, long delay, TimeUnit unit) Executes a runnable after a fixed delaygetName()voidModifies the execution rate of the given execution unit.voidmodifyFixedRate(String owner, String name, Runnable command, int newRate, TimeUnit newUnit) voidregister(String owner, String name, SelfSchedulingRunnable command) Registers a self scheduling command to be executed.voidRegisters a command to be executing repeatedly at the specified rate.voidRegisters a command to be executing repeatedly at the specified rate.voidregisterAtFixedRate(String owner, String name, Runnable command, int rate, TimeUnit unit) Registers a command to be executed with a fixed rate rather than a fixed delay.voidregisterAtFixedRateWithInitialDelay(String owner, String name, Runnable command, int rate, TimeUnit unit, int initialDelay) Registers a command to be executed with a fixed rate after some initial delay.voidregisterWithInitialDelay(String owner, String name, Runnable command, int rate, int initialDelay) Registers a command to be executing repeatedly at the specified rate with an initial delay.voidregisterWithInitialDelay(String owner, String name, Runnable command, int rate, TimeUnit unit, int initialDelay) Registers a command to be executing repeatedly at the specified rate with an initial delay.protected voidscheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) Schedules a runnable to execute with a fixed delay, and after an initial delay, much likeExecutionManager.registerWithInitialDelay(String, String, Runnable, int, TimeUnit, int).voidshutdown()Stops all execution gracefully.protected voidsynchedUpdateTaskMap(String owner, String name, ScheduledFuture<?> future) Updates the task map.toString()voidunRegister(String owner, String name) De-registers the execution unit.voidunRegister(String owner, String name, boolean interrupt) De-registers the execution unit.voidunRegisterAll(String owner) Unregisters all tasks for a given owner.voidunSchedule(String taskId) 
- 
Constructor Details- 
BasicExecutionEnginepublic BasicExecutionEngine()
- 
BasicExecutionEngine
- 
BasicExecutionEngine
- 
BasicExecutionEngine
 
- 
- 
Method Details- 
getName
- 
shutdownpublic void shutdown()Description copied from interface:ExecutionManagerStops all execution gracefully.- Specified by:
- shutdownin interface- ExecutionManager
 
- 
schedulepublic String schedule(String taskName, Runnable task, String cronPattern) throws it.sauronsoftware.cron4j.InvalidPatternException - Throws:
- it.sauronsoftware.cron4j.InvalidPatternException
 
- 
unSchedule
- 
registerDescription copied from interface:ExecutionManagerRegisters a command to be executing repeatedly at the specified rate. If the name is already registered, the existing execution unit will be modified.- Specified by:
- registerin interface- ExecutionManager
- 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.
- rate- The amount of time to wait in between invocations of the command, in milliseconds.
 
- 
registerDescription copied from interface:ExecutionManagerRegisters a command to be executing repeatedly at the specified rate. If the name is already registered, the existing execution unit will be modified.- Specified by:
- registerin interface- ExecutionManager
- 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.
 
- 
registerAtFixedRatepublic void registerAtFixedRate(String owner, String name, Runnable command, int rate, TimeUnit unit) Description copied from interface:ExecutionManagerRegisters a command to be executed with a fixed rate rather than a fixed delay.- Specified by:
- registerAtFixedRatein interface- ExecutionManager
 
- 
registerAtFixedRateWithInitialDelaypublic void registerAtFixedRateWithInitialDelay(String owner, String name, Runnable command, int rate, TimeUnit unit, int initialDelay) Description copied from interface:ExecutionManagerRegisters a command to be executed with a fixed rate after some initial delay.- Specified by:
- registerAtFixedRateWithInitialDelayin interface- ExecutionManager
 
- 
synchedUpdateTaskMapUpdates the task map. Task map MUST be synchronized before calling this.
- 
registerWithInitialDelaypublic void registerWithInitialDelay(String owner, String name, Runnable command, int rate, int initialDelay) Description copied from interface:ExecutionManagerRegisters a command to be executing repeatedly at the specified rate with an initial delay.- Specified by:
- registerWithInitialDelayin interface- ExecutionManager
 
- 
registerWithInitialDelaypublic void registerWithInitialDelay(String owner, String name, Runnable command, int rate, TimeUnit unit, int initialDelay) Description copied from interface:ExecutionManagerRegisters a command to be executing repeatedly at the specified rate with an initial delay.- Specified by:
- registerWithInitialDelayin interface- ExecutionManager
 
- 
modifyModifies the execution rate of the given execution unit. Basically just unregisters and registers. Can also be used to modify the Runnable associated with the name.
- 
modifyFixedRate
- 
unRegisterDe-registers the execution unit. If the unit is in the process of running, it will be interrupted.- Specified by:
- unRegisterin interface- ExecutionManager
 
- 
unRegisterDe-registers the execution unit.- Specified by:
- unRegisterin interface- ExecutionManager
- Parameters:
- interrupt- Interrupts the execution if it is currently occurring. If false, waits for completion.
 
- 
unRegisterAllUnregisters all tasks for a given owner.- Specified by:
- unRegisterAllin interface- ExecutionManager
 
- 
executeOnceExecutes a runnable one time as soon as possible.- Specified by:
- executeOncein interface- ExecutionManager
 
- 
executeOnceDescription copied from interface:ExecutionManagerExcutes a runnable one time after a delay, specified in milliseconds- Specified by:
- executeOncein interface- ExecutionManager
 
- 
executeOncepublic ScheduledFuture<?> executeOnce(Runnable command, long delay, TimeUnit unit) throws RejectedExecutionException Executes a runnable after a fixed delay- Specified by:
- executeOncein interface- ExecutionManager
- Throws:
- RejectedExecutionException
 
- 
registerDescription copied from interface:ExecutionManagerRegisters a self scheduling command to be executed. Self scheduling commands provide their own execution delay, which can change from exec to exec.- Specified by:
- registerin interface- ExecutionManager
 
- 
scheduleNext
- 
scheduleWithFixedDelaypublic ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) Description copied from interface:ExecutionManagerSchedules a runnable to execute with a fixed delay, and after an initial delay, much likeExecutionManager.registerWithInitialDelay(String, String, Runnable, int, TimeUnit, int). The difference is that this method returns a ScheduledFuture that can be used to cancel the task.- Specified by:
- scheduleWithFixedDelayin interface- ExecutionManager
 
- 
getTaskOwners
- 
getTasks
- 
toString
 
-