Package org.eclipse.jetty.util.thread
Class ScheduledExecutorScheduler
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.thread.ScheduledExecutorScheduler
-
public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler, Dumpable
Implementation ofSchedulerbased on JDK'sScheduledThreadPoolExecutor.While use of
ScheduledThreadPoolExecutorcreates 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Scheduler
Scheduler.Task
-
-
Constructor Summary
Constructors Constructor Description ScheduledExecutorScheduler()ScheduledExecutorScheduler(String name, boolean daemon)ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader threadFactoryClassLoader)ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader threadFactoryClassLoader, ThreadGroup threadGroup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoStart()protected voiddoStop()Stringdump()voiddump(Appendable out, String indent)Dump this object (and children) into an Appendable using the provided indent after any new lines.Scheduler.Taskschedule(Runnable task, long delay, TimeUnit unit)-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
-
-
-
Constructor Detail
-
ScheduledExecutorScheduler
public ScheduledExecutorScheduler()
-
ScheduledExecutorScheduler
public ScheduledExecutorScheduler(String name, boolean daemon)
-
ScheduledExecutorScheduler
public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader threadFactoryClassLoader)
-
ScheduledExecutorScheduler
public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader threadFactoryClassLoader, ThreadGroup threadGroup)
-
-
Method Detail
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classAbstractLifeCycle- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classAbstractLifeCycle- Throws:
Exception
-
schedule
public Scheduler.Task schedule(Runnable task, long delay, TimeUnit unit)
-
dump
public void dump(Appendable out, String indent) throws IOException
Description copied from interface:DumpableDump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dumpin interfaceDumpable- Parameters:
out- The appendable to dump toindent- The indent to apply after any new lines.- Throws:
IOException
-
-