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.AbstractLifeCycleListener
Scheduler.Task
LifeCycle.Listener
Constructor and Description |
---|
ScheduledExecutorScheduler() |
ScheduledExecutorScheduler(java.lang.String name,
boolean daemon) |
ScheduledExecutorScheduler(java.lang.String name,
boolean daemon,
java.lang.ClassLoader threadFactoryClassLoader) |
ScheduledExecutorScheduler(java.lang.String name,
boolean daemon,
java.lang.ClassLoader threadFactoryClassLoader,
java.lang.ThreadGroup threadGroup) |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart() |
protected void |
doStop() |
java.lang.String |
dump() |
void |
dump(java.lang.Appendable out,
java.lang.String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
Scheduler.Task |
schedule(java.lang.Runnable task,
long delay,
java.util.concurrent.TimeUnit unit) |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stop
dump, dumpObject, dumpObjects, dumpSelf
public ScheduledExecutorScheduler()
public ScheduledExecutorScheduler(java.lang.String name, boolean daemon)
public ScheduledExecutorScheduler(java.lang.String name, boolean daemon, java.lang.ClassLoader threadFactoryClassLoader)
public ScheduledExecutorScheduler(java.lang.String name, boolean daemon, java.lang.ClassLoader threadFactoryClassLoader, java.lang.ThreadGroup threadGroup)
protected void doStart() throws java.lang.Exception
doStart
in class AbstractLifeCycle
java.lang.Exception
protected void doStop() throws java.lang.Exception
doStop
in class AbstractLifeCycle
java.lang.Exception
public Scheduler.Task schedule(java.lang.Runnable task, long delay, java.util.concurrent.TimeUnit unit)
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
Dumpable
Copyright © 1995–2023 Webtide. All rights reserved.