public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler, Dumpable
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.AbstractLifeCycleListenerScheduler.TaskLifeCycle.Listener| Constructor and Description |
|---|
ScheduledExecutorScheduler() |
ScheduledExecutorScheduler(String name,
boolean daemon) |
ScheduledExecutorScheduler(String name,
boolean daemon,
ClassLoader threadFactoryClassLoader) |
ScheduledExecutorScheduler(String name,
boolean daemon,
ClassLoader threadFactoryClassLoader,
ThreadGroup threadGroup) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart() |
protected void |
doStop() |
String |
dump() |
void |
dump(Appendable out,
String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
Scheduler.Task |
schedule(Runnable task,
long delay,
TimeUnit unit) |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stopdump, dumpObject, dumpObjectspublic ScheduledExecutorScheduler()
public ScheduledExecutorScheduler(String name, boolean daemon)
public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader threadFactoryClassLoader)
public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader threadFactoryClassLoader, ThreadGroup threadGroup)
protected void doStart()
throws Exception
doStart in class AbstractLifeCycleExceptionprotected void doStop()
throws Exception
doStop in class AbstractLifeCycleExceptionpublic Scheduler.Task schedule(Runnable task, long delay, TimeUnit unit)
public void dump(Appendable out, String indent) throws IOException
Dumpabledump in interface Dumpableout - The appendable to dump toindent - The indent to apply after any new lines.IOExceptionCopyright © 1995–2018 Webtide. All rights reserved.