lucee.Componentcachebox.system.async.executors.Executor
This is the ColdBox Executor class which connects your code to the Java Scheduling services to execute tasks on. The native property models the injected Java executor which can be: - Fixed - Cached - Single - Scheduled
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
name
The human name of this executor.
|
true
|
false
|
|
any
|
native
The native Java executor class modeled in this executor.
|
true
|
false
|
|
numeric
|
shutdownTimeout
The default timeout the executor service will wait for all of it's tasks to shutdown.
|
30
|
true
|
false
|
Constructor Summary | |
---|---|
init(any name, any executor, [boolean debug='false'], [boolean loadAppContext='true'], [numeric shutdownTimeout='30'])
Constructor. |
Method Summary | |
---|---|
boolean
|
awaitTermination(numeric timeout, [any timeUnit='seconds'])
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or. |
Executor
|
err(any var)
Utility to send to output to the error stream. |
numeric
|
getActiveCount()
Returns the approximate number of threads that are actively executing tasks. |
numeric
|
getCompletedTaskCount()
Returns the approximate total number of tasks that have completed execution. |
numeric
|
getCorePoolSize()
Returns the core number of threads. |
numeric
|
getLargestPoolSize()
Returns the largest number of threads that have ever simultaneously been in the pool. |
numeric
|
getMaximumPoolSize()
Returns the maximum allowed number of threads. |
string
|
getName()
|
string
|
getNative()
|
numeric
|
getPoolSize()
Returns the current number of threads in the pool. |
any
|
getQueue()
Returns the task queue used by this executor. |
string
|
getShutdownTimeout()
|
struct
|
getStats()
Our very own stats struct map to give you a holistic view of the schedule. |
numeric
|
getTaskCount()
Returns the approximate total number of tasks that have ever been scheduled for execution. |
boolean
|
isShutdown()
Returns true if this executor has been shut down. |
boolean
|
isTerminated()
Returns true if all tasks have completed following shut down. |
boolean
|
isTerminating()
Returns true if this executor is in the process of terminating after shutdown() or shutdownNow() but has. |
Executor
|
out(any var)
Utility to send to output to the output stream. |
any
|
setName(any name)
|
any
|
setNative(any native)
|
any
|
setShutdownTimeout(numeric shutdownTimeout)
|
Executor
|
shutdown()
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. |
Executor
|
shutdownAndAwaitTermination([numeric timeout='[runtime expression]'])
Shuts down the executor in two phases, first by calling the shutdown() and rejecting all incoming tasks. |
any
|
shutdownNow()
Attempts to stop all actively executing tasks, halts the processing of. |
cachebox.system.async.executors.FutureTask
|
submit(any callable, [any method='run'])
Submit a task into the executor which can return a result if any. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
name
- The name of the executorexecutor
- The native executor classdebug
- Add output debuggingloadAppContext
- Load the CFML App contexts or not, disable if not usedshutdownTimeout
- The timeout in seconds to use when gracefully shutting down the executor. Defaults to 30 seconds.Property Detail |
---|
The human name of this executor
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe native Java executor class modeled in this executor
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe default timeout the executor service will wait for all of it's tasks to shutdown. The default is 30 seconds. This number is in seconds.
access
- publicrequired
- falsereturntype
- anyserializable
- trueMethod Detail |
---|
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
timeout
- The maximum time to waittimeUnit
- The time unit to use, available units are: days, hours, microseconds, milliseconds, minutes, nanoseconds, and seconds. The default is secondsUtility to send to output to the error stream
var
- Variable/Message to sendReturns the approximate number of threads that are actively executing tasks.
Returns the approximate total number of tasks that have completed execution.
Returns the core number of threads.
Returns the largest number of threads that have ever simultaneously been in the pool.
Returns the maximum allowed number of threads.
Returns the current number of threads in the pool.
Returns the task queue used by this executor.
Our very own stats struct map to give you a holistic view of the schedule and it's executor
Returns the approximate total number of tasks that have ever been scheduled for execution.
Returns true if this executor has been shut down.
Returns true if all tasks have completed following shut down.
Returns true if this executor is in the process of terminating after shutdown() or shutdownNow() but has not completely terminated.
Utility to send to output to the output stream
var
- Variable/Message to sendname
native
shutdownTimeout
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down. This method does not wait for previously submitted tasks to complete execution. Use awaitTermination to do that.
Shuts down the executor in two phases, first by calling the shutdown() and rejecting all incoming tasks. Second, calling shutdownNow() aggresively if tasks did not shutdown on time to cancel any lingering tasks.
timeout
- The timeout in seconds to wait for the shutdown. By deafult we use the default on the property shutdownTimeout (30s)Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. This method does not wait for actively executing tasks to terminate. Use awaitTermination to do that. There are no guarantees beyond best-effort attempts to stop processing actively executing tasks. This implementation cancels tasks via Thread.interrupt(), so any task that fails to respond to interrupts may never terminate.
Submit a task into the executor which can return a result if any. The result of this call is a ColdBox FutureTask from which you can monitor, cancel, or get the result of the the executing task.
callable
- THe callable closure/lambda/cfc to executemethod
- The default method to execute if the runnable is a CFC, defaults to `run()`