public class SimpleUnitTestSupportScheduler extends ScheduledThreadPoolExecutor implements org.mule.runtime.api.scheduler.Scheduler
Scheduler implementation to be used in unit tests. Provides a thread pool with just 2 threads.
The size of the pool is 2 because some tests may dispatch 2 independent tasks that have to synchronize on each other. Having only one pool may cause one task to wait on another that will never start.
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| Constructor and Description |
|---|
SimpleUnitTestSupportScheduler(int corePoolSize,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) |
| Modifier and Type | Method and Description |
|---|---|
protected <V> RunnableScheduledFuture<V> |
decorateTask(Callable<V> callable,
RunnableScheduledFuture<V> task) |
protected <V> RunnableScheduledFuture<V> |
decorateTask(Runnable runnable,
RunnableScheduledFuture<V> task) |
String |
getName() |
ScheduledFuture<?> |
scheduleWithCronExpression(Runnable command,
String cronExpression) |
ScheduledFuture<?> |
scheduleWithCronExpression(Runnable command,
String cronExpression,
TimeZone timeZone) |
void |
stop() |
execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdown, shutdownNow, submit, submit, submitafterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskForclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitschedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelayawaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submitpublic SimpleUnitTestSupportScheduler(int corePoolSize,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
public void stop()
stop in interface org.mule.runtime.api.scheduler.Schedulerprotected <V> RunnableScheduledFuture<V> decorateTask(Callable<V> callable, RunnableScheduledFuture<V> task)
decorateTask in class ScheduledThreadPoolExecutorprotected <V> RunnableScheduledFuture<V> decorateTask(Runnable runnable, RunnableScheduledFuture<V> task)
decorateTask in class ScheduledThreadPoolExecutorpublic 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 String getName()
getName in interface org.mule.runtime.api.scheduler.SchedulerCopyright © 2003–2021 MuleSoft, Inc.. All rights reserved.