public class SchedulerConfig extends Object
Scheduler obtained through the SchedulerService.| Modifier and Type | Method and Description |
|---|---|
static SchedulerConfig |
config()
Whenever possible, use a
SchedulerConfig from the Registry or inject it rather than building a new one with
this method. |
boolean |
equals(Object o) |
Optional<Boolean> |
getDirectRunCpuLightWhenTargetBusy() |
Integer |
getMaxConcurrentTasks() |
String |
getSchedulerName() |
Supplier<Long> |
getShutdownTimeoutMillis() |
Optional<Boolean> |
getWaitAllowed() |
int |
hashCode() |
boolean |
hasName() |
SchedulerConfig |
withDirectRunCpuLightWhenTargetBusy(boolean runCpuLightWhenTargetBusy)
|
SchedulerConfig |
withMaxConcurrentTasks(int maxConcurrentTasks)
Sets the max tasks that can be run at the same time for the target
Scheduler. |
SchedulerConfig |
withName(String schedulerName)
Sets the name for the target
Scheduler, which will override the default one. |
SchedulerConfig |
withPrefix(String schedulerPrefix)
Sets the prefix to prepend to the name for the target
Scheduler, which will override the default one. |
SchedulerConfig |
withShutdownTimeout(long shutdownTimeout,
TimeUnit shutdownTimeoutUnit)
Sets the graceful shutdown timeout to use when stopping the target
Scheduler. |
SchedulerConfig |
withShutdownTimeout(Supplier<Long> shutdownTimeoutSupplier,
TimeUnit shutdownTimeoutUnit)
Sets the graceful shutdown timeout to use when stopping the target
Scheduler. |
SchedulerConfig |
withWaitAllowed(boolean waitAllowed)
|
public static SchedulerConfig config()
SchedulerConfig from the Registry or inject it rather than building a new one with
this method. SchedulerConfigs obtained that way are already configured with base configuration based on the artifact
it belongs to.public SchedulerConfig withMaxConcurrentTasks(int maxConcurrentTasks)
Scheduler.
This is useful to apply throttling on the target Scheduler. The way exceeding tasks will be handled is determined by
the target Scheduler.
maxConcurrentTasks - how many tasks can be running at the same time for the target Scheduler.public Integer getMaxConcurrentTasks()
Scheduler.public SchedulerConfig withPrefix(String schedulerPrefix)
Scheduler, which will override the default one.schedulerPrefix - the prefix for the name for the target Scheduler.public SchedulerConfig withName(String schedulerName)
Scheduler, which will override the default one.schedulerName - the name for the target Scheduler.public boolean hasName()
true if withName(String) was called with a non-null value, false otherwise.public SchedulerConfig withDirectRunCpuLightWhenTargetBusy(boolean runCpuLightWhenTargetBusy)
true, if the target custom Scheduler tries to dispatch a task to the cpu-light Scheduler
when it's busy, the task will be run by the target Scheduler instead of dispatching it to cpu-lite.
This is only applicable for custom Schedulers. This behaviour cannot be changed for the runtime managed
Scheduler.
A custom scheduler may have flags set for both runCpuLightWhenTargetBusy and waitAllowed. In such case, the
behaviour when the target Scheduler is busy depends on the type of the target Scheduler: if it's cpu-light or
the same as the current, the task will run directly, otherwise it will wait.
public SchedulerConfig withWaitAllowed(boolean waitAllowed)
Scheduler may block to wait when dispatching to a busy Scheduler.
This is only applicable for custom Schedulers. This behaviour cannot be changed for the runtime managed
Scheduler.
A custom scheduler may have flags set for both runCpuLightWhenTargetBusy and waitAllowed. In such case, the
behaviour when the target Scheduler is busy depends on the type of the target Scheduler: if it's cpu-light or
the same as the current, the task will run directly, otherwise it will wait.
public SchedulerConfig withShutdownTimeout(Supplier<Long> shutdownTimeoutSupplier, TimeUnit shutdownTimeoutUnit)
Scheduler.shutdownTimeoutSupplier - a supplier of the value of the timeout to use when gracefully stopping the target
Scheduler, expressed in the provided TimeUnit.shutdownTimeoutUnit - the unit of the timeout to use when gracefully stopping the target Scheduler.public SchedulerConfig withShutdownTimeout(long shutdownTimeout, TimeUnit shutdownTimeoutUnit)
Scheduler.public Supplier<Long> getShutdownTimeoutMillis()
Scheduler, in millis.Copyright © 2021 MuleSoft, Inc.. All rights reserved.