lucee.Componentcoldbox.system.async.executors.Executor
coldbox.system.async.executors.ScheduledExecutor
This is a specialized executor that deals with scheduled tasks using the Java ScheduledExecutorService. With it, you will be able to create different types of tasks: - `submit()` : Submit tasks just like a normal executors (can return results) - `schedule()` : Schedule one-time executing tasks with or without delays (can return results) - `scheduleAtFixedRate()` : Schedule tasks that will execute on a specific frequency (do not return results) - `scheduleWithFixedDelay()` : Schedule tasks that will execute on a specific delayed schedule after each of them completes (do not return results) All of the scheduling methods will return a ScheduledFuture object that you can use to monitor and get results from the tasks at hand, if any.
Method Summary | |
---|---|
any
|
buildJavaRunnable(any task, any method)
Build out a Java Runnable from the incoming cfc/closure/lambda/udf that will be sent to the schedulers. |
coldbox.system.async.executors.ScheduledTask
|
newSchedule(any task, [any method='run'])
Build out a new scheduled task. |
coldbox.system.async.executors.ScheduledTask
|
newTask([any name='[runtime expression]'], [any task], [any method='run'])
Build out a new scheduled task representation. |
coldbox.system.async.executors.ScheduledFuture
|
schedule(any task, [numeric delay='0'], [any timeUnit='milliseconds'], [any method='run'])
This method is used to register a runnable CFC, closure or lambda so it can. |
coldbox.system.async.executors.ScheduledFuture
|
scheduleAtFixedRate(any task, numeric every, [numeric delay='0'], [any timeUnit='milliseconds'], [any method='run'])
Creates and executes a periodic action that becomes enabled first after. |
coldbox.system.async.executors.ScheduledFuture
|
scheduleWithFixedDelay(any task, numeric spacedDelay, [numeric delay='0'], [any timeUnit='milliseconds'], [any method='run'])
Creates and executes a periodic action that becomes enabled first after the given. |
Methods inherited from class coldbox.system.async.executors.Executor |
---|
awaitTermination, getActiveCount, getCompletedTaskCount, getCorePoolSize, getLargestPoolSize, getMaximumPoolSize, getName, getNative, getPoolSize, getQueue, getStats, getTaskCount, init, isShutdown, isTerminated, isTerminating, setName, setNative, shutdown, shutdownNow, submit |
Methods inherited from class lucee.Component |
---|
None |
Method Detail |
---|
Build out a Java Runnable from the incoming cfc/closure/lambda/udf that will be sent to the schedulers.
task
- The runnable task closure/lambda/cfcmethod
- The default method to execute if the runnable is a CFC, defaults to `run()`Build out a new scheduled task
task
- The closure or cfc that represents the taskmethod
- The method on the cfc to call, defaults to "run" (optional)Build out a new scheduled task representation. Calling this method does not mean that the task is executed.
name
- The name of the tasktask
- The closure or cfc that represents the task (optional)method
- The method on the cfc to call, defaults to "run" (optional)This method is used to register a runnable CFC, closure or lambda so it can execute as a scheduled task according to the delay and period you have set in the Schedule. The method will register the runnable and send it for execution, the result is a ScheduledFuture. Periodic tasks do NOT return a result, while normal delayed tasks can.
task
- The runnable task closure/lambda/cfcdelay
- The time to delay the first executiontimeUnit
- The time unit to use, available units are: days, hours, microseconds, milliseconds, minutes, nanoseconds, and seconds. The default is millisecondsmethod
- The default method to execute if the runnable is a CFC, defaults to `run()`Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after delay then delay+every, then delay + 2 * every, and so on. If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the executor. If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
task
- The runnable task closure/lambda/cfcevery
- The period between successive executionsdelay
- The time to delay the first executiontimeUnit
- The time unit to use, available units are: days, hours, microseconds, milliseconds, minutes, nanoseconds, and seconds. The default is millisecondsmethod
- The default method to execute if the runnable is a CFC, defaults to `run()`Creates and executes a periodic action that becomes enabled first after the given delay, and subsequently with the given spacedDelay between the termination of one execution and the commencement of the next. If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the executor.
task
- The runnable task closure/lambda/cfcspacedDelay
- The delay between the termination of one execution and the commencement of the nextdelay
- The time to delay the first executiontimeUnit
- The time unit to use, available units are: days, hours, microseconds, milliseconds, minutes, nanoseconds, and seconds. The default is millisecondsmethod
- The default method to execute if the runnable is a CFC, defaults to `run()`