public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler
Scheduler
based on JDK's ScheduledThreadPoolExecutor
.
While use of ScheduledThreadPoolExecutor
creates futures that will not be used,
it has the advantage of allowing to set a property to remove cancelled tasks from its
queue even if the task did not fire, which provides a huge benefit in the performance
of garbage collection in young generation.AbstractLifeCycle.AbstractLifeCycleListener
Scheduler.Task
LifeCycle.Listener
Constructor and Description |
---|
ScheduledExecutorScheduler() |
ScheduledExecutorScheduler(String name,
boolean daemon) |
ScheduledExecutorScheduler(String name,
boolean daemon,
ClassLoader threadFactoryClassLoader) |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart() |
protected void |
doStop() |
Scheduler.Task |
schedule(Runnable task,
long delay,
TimeUnit unit) |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public ScheduledExecutorScheduler()
public ScheduledExecutorScheduler(String name, boolean daemon)
public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader threadFactoryClassLoader)
protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
public Scheduler.Task schedule(Runnable task, long delay, TimeUnit unit)
Copyright © 1995-2015 Webtide. All Rights Reserved.