public class DefaultScheduler extends AbstractExecutorService implements org.mule.runtime.api.scheduler.Scheduler
ScheduledExecutorService that adds tracking of the source of the dispatched tasks.| Modifier and Type | Field and Description |
|---|---|
protected Consumer<org.mule.runtime.api.scheduler.Scheduler> |
shutdownCallback |
protected Supplier<Long> |
shutdownTimeoutMillis |
| Constructor and Description |
|---|
DefaultScheduler(String name,
ExecutorService executor,
int parallelTasksEstimate,
ScheduledExecutorService scheduledExecutor,
org.quartz.Scheduler quartzScheduler,
ThreadType threadsType,
Supplier<Long> shutdownTimeoutMillis,
Consumer<org.mule.runtime.api.scheduler.Scheduler> shutdownCallback) |
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submitprotected final Consumer<org.mule.runtime.api.scheduler.Scheduler> shutdownCallback
public DefaultScheduler(String name, ExecutorService executor, int parallelTasksEstimate, ScheduledExecutorService scheduledExecutor, org.quartz.Scheduler quartzScheduler, ThreadType threadsType, Supplier<Long> shutdownTimeoutMillis, Consumer<org.mule.runtime.api.scheduler.Scheduler> shutdownCallback)
name - the name of this schedulerexecutor - the actual executor that will run the dispatched tasks.parallelTasksEstimate - an estimate of how many threads will be, at maximum, in the underlying executorscheduledExecutor - the executor that will handle the delayed/periodic tasks. This will not execute the actual tasks,
but will dispatch it to the executor at the appropriate time.quartzScheduler - the quartz object that will handle tasks scheduled with cron expressions. This will not execute the
actual tasks, but will dispatch it to the executor at the appropriate time.threadsType - The ThreadType that matches with the Threads managed by this Scheduler.shutdownTimeoutMillis - the time in millis to wait for the graceful stop of this schedulershutdownCallback - a callback to be invoked when this scheduler is stopped/shutdown.public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
schedule in interface ScheduledExecutorServicepublic <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
schedule in interface ScheduledExecutorServicepublic ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
scheduleAtFixedRate in interface ScheduledExecutorServicepublic ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
scheduleWithFixedDelay in interface ScheduledExecutorServicepublic ScheduledFuture<?> scheduleWithCronExpression(Runnable command, String cronExpression)
scheduleWithCronExpression in interface org.mule.runtime.api.scheduler.Schedulerpublic ScheduledFuture<?> scheduleWithCronExpression(Runnable command, String cronExpression, TimeZone timeZone)
scheduleWithCronExpression in interface org.mule.runtime.api.scheduler.Schedulerpublic void setJobClass(Class<? extends QuartzCronJob> jobClass)
public void shutdown()
shutdown in interface ExecutorServiceprotected void doShutdown()
public List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorServicepublic boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedExceptionpublic void stop()
stop in interface org.mule.runtime.api.scheduler.Schedulerprotected void stopFinally()
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
newTaskFor in class AbstractExecutorServiceprotected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value)
newTaskFor in class AbstractExecutorServiceprotected void checkShutdown()
protected void taskFinished(RunnableFuture<?> task)
protected void putTask(RunnableFuture<?> task, ScheduledFuture<?> scheduledFuture)
protected ScheduledFuture<?> removeTask(RunnableFuture<?> task)
protected void tryTerminate()
public ThreadType getThreadType()
public String getName()
getName in interface org.mule.runtime.api.scheduler.SchedulerCopyright © 2003–2018 MuleSoft, Inc.. All rights reserved.