@NoImplement public interface SchedulerService extends Service
This interface provides access to different schedulers, each with its own configured tuning options, optimized for some specific kind of work. Artifacts that need to dispatch tasks need to carefully determine which scheduler best fits the nature of the task in order to keep the resources usage and the impact on other artifacts at a minimum.
The Schedulers returned by methods in the implementations must provide access the the thread pools in the Mule Runtime
that have the expected tuning configuration. Each Scheduler will have its own lifecycle, managed by its user and NOT
this service.
| Modifier and Type | Method and Description |
|---|---|
Scheduler |
cpuIntensiveScheduler()
Builds a fresh
Scheduler with a default configuration for heavy computation or CPU intensive tasks. |
Scheduler |
cpuIntensiveScheduler(SchedulerConfig config)
Builds a fresh
Scheduler for heavy computation or CPU intensive tasks. |
Scheduler |
cpuIntensiveScheduler(SchedulerConfig config,
SchedulerPoolsConfigFactory poolsConfigFactory)
Builds a fresh
Scheduler for heavy computation or CPU intensive tasks. |
Scheduler |
cpuLightScheduler()
Builds a fresh
Scheduler with a default configuration for light CPU tasks. |
Scheduler |
cpuLightScheduler(SchedulerConfig config)
Builds a fresh
Scheduler for light CPU tasks. |
Scheduler |
cpuLightScheduler(SchedulerConfig config,
SchedulerPoolsConfigFactory poolsConfigFactory)
Builds a fresh
Scheduler for light CPU tasks. |
Scheduler |
customScheduler(SchedulerConfig config)
Builds a fresh
Scheduler for custom tasks. |
Scheduler |
customScheduler(SchedulerConfig config,
int queueSize)
Builds a fresh
Scheduler for custom tasks. |
List<SchedulerView> |
getSchedulers()
Provides a read-only view of all currently active
Schedulers created through this service. |
Scheduler |
ioScheduler()
Builds a fresh
Scheduler with a default configuration for blocking I/O tasks. |
Scheduler |
ioScheduler(SchedulerConfig config)
Builds a fresh
Scheduler for blocking I/O tasks. |
Scheduler |
ioScheduler(SchedulerConfig config,
SchedulerPoolsConfigFactory poolsConfigFactory)
Builds a fresh
Scheduler for blocking I/O tasks. |
default boolean |
isCurrentThreadForCpuWork()
Determines if the current thread may be locked.
|
default boolean |
isCurrentThreadForCpuWork(SchedulerPoolsConfigFactory poolsConfigFactory)
Determines if the current thread may be locked.
|
getContractName, getSplashMessagegetNameScheduler cpuLightScheduler()
Scheduler with a default configuration for light CPU tasks. The returned Scheduler is backed
by the Mule runtime cpu-light executor, which is shared by all Schedulers returned by this method.
A task is considered cpu-light if it doesn't block at any time and its duration is less than 10 milliseconds.
Implementations must get the appropriate config from the runtime context to build the target Scheduler. This method
must act only as a delegate of cpuLightScheduler(SchedulerConfig, SchedulerPoolsConfigFactory).
cpu-light tasks.Scheduler ioScheduler()
Scheduler with a default configuration for blocking I/O tasks. The returned Scheduler is
backed by the Mule runtime blocking I/O executor, which is shared by all Schedulers returned by this method.
A task is considered blocking I/O if it spends most of it's clock duration blocked due to I/O operations.
Implementations must get the appropriate config from the runtime context to build the target Scheduler. This method
must act only as a delegate of ioScheduler(SchedulerConfig, SchedulerPoolsConfigFactory).
blocking I/O tasks.Scheduler cpuIntensiveScheduler()
Scheduler with a default configuration for heavy computation or CPU intensive tasks. The returned
Scheduler is backed by the Mule runtime computation executor, which is shared by all Schedulers returned by
this method.
A task is considered a CPU intensive if its duration is more than 10 milliseconds and less than 20% of its clock time
is due to blocking.
Implementations must get the appropriate config from the runtime context to build the target Scheduler. This method
must act only as a delegate of cpuIntensiveScheduler(SchedulerConfig, SchedulerPoolsConfigFactory).
CPU intensive tasks.Scheduler cpuLightScheduler(SchedulerConfig config)
Scheduler for light CPU tasks. The returned Scheduler is backed by the Mule runtime cpu-light
executor, which is shared by all Schedulers returned by this method.
A task is considered cpu-light if it doesn't block at any time and its duration is less than 10 milliseconds.
If the provided config has maxConcurrentTasks set, exceeding tasks will block the caller, until a running
task is finished.
config - allows customization of the returned scheduler.cpu-light tasks.Scheduler ioScheduler(SchedulerConfig config)
Scheduler for blocking I/O tasks. The returned Scheduler is backed by the Mule runtime
blocking I/O executor, which is shared by all Schedulers returned by this method.
A task is considered blocking I/O if it spends most of it's clock duration blocked due to I/O operations.
If the provided config has maxConcurrentTasks set, exceeding tasks will block the caller, until a running
task is finished.
config - allows customization of the returned scheduler.blocking I/O tasks.Scheduler cpuIntensiveScheduler(SchedulerConfig config)
Scheduler for heavy computation or CPU intensive tasks. The returned Scheduler is backed by
the Mule runtime computation executor, which is shared by all Schedulers returned by this method.
A task is considered a CPU intensive if its duration is more than 10 milliseconds and less than 20% of its clock time
is due to blocking.
If the provided config has maxConcurrentTasks set, exceeding tasks will block the caller, until a running
task is finished.
config - allows customization of the returned scheduler.CPU intensive tasks.Scheduler cpuLightScheduler(SchedulerConfig config, SchedulerPoolsConfigFactory poolsConfigFactory)
Scheduler for light CPU tasks. The returned Scheduler is backed by the Mule runtime cpu-light
executor, which is shared by all Schedulers returned by this method.
A task is considered cpu-light if it doesn't block at any time and its duration is less than 10 milliseconds.
If the provided config has maxConcurrentTasks set, exceeding tasks will block the caller, until a running
task is finished.
config - allows customization of the returned scheduler.poolsConfigFactory - the configuration to use for the thread pools that the schedulers use.cpu-light tasks.Scheduler ioScheduler(SchedulerConfig config, SchedulerPoolsConfigFactory poolsConfigFactory)
Scheduler for blocking I/O tasks. The returned Scheduler is backed by the Mule runtime
blocking I/O executor, which is shared by all Schedulers returned by this method.
A task is considered blocking I/O if it spends most of it's clock duration blocked due to I/O operations.
If the provided config has maxConcurrentTasks set, exceeding tasks will block the caller, until a running
task is finished.
config - allows customization of the returned scheduler.poolsConfigFactory - the configuration to use for the thread pools that the schedulers use.blocking I/O tasks.Scheduler cpuIntensiveScheduler(SchedulerConfig config, SchedulerPoolsConfigFactory poolsConfigFactory)
Scheduler for heavy computation or CPU intensive tasks. The returned Scheduler is backed by
the Mule runtime computation executor, which is shared by all Schedulers returned by this method.
A task is considered a CPU intensive if its duration is more than 10 milliseconds and less than 20% of its clock time
is due to blocking.
If the provided config has maxConcurrentTasks set, exceeding tasks will block the caller, until a running
task is finished.
config - allows customization of the returned scheduler.poolsConfigFactory - the configuration to use for the thread pools that the schedulers use.CPU intensive tasks.Scheduler customScheduler(SchedulerConfig config)
Scheduler for custom tasks. The returned Scheduler is backed by an
ExecutorService built with the given corePoolSize threads and a
SynchronousQueue.config - allows customization of the returned scheduler.custom tasks.Scheduler customScheduler(SchedulerConfig config, int queueSize)
Scheduler for custom tasks. The returned Scheduler is backed by an
ExecutorService built with the given corePoolSize threads and a
LinkedBlockingQueue with the given queueSize.config - allows customization of the returned scheduler.custom tasks.default boolean isCurrentThreadForCpuWork()
Thread.currentThread() belongs to a ThreadGroup indication that waiting/blocking is allowed.default boolean isCurrentThreadForCpuWork(SchedulerPoolsConfigFactory poolsConfigFactory)
poolsConfigFactory - the configuration to use for the thread pools that the schedulers use.Thread.currentThread() belongs to a ThreadGroup indication that waiting/blocking is allowed.List<SchedulerView> getSchedulers()
Schedulers created through this service.List of SchedulerViews for all currently active Schedulers.Copyright © 2019 MuleSoft, Inc.. All rights reserved.