Class ScheduledExecutorScheduler

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.thread.ScheduledExecutorScheduler
All Implemented Interfaces:
Dumpable, LifeCycle, Scheduler

@ManagedObject public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler, Dumpable
Implementation of 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.

  • Constructor Details

    • ScheduledExecutorScheduler

      public ScheduledExecutorScheduler()
    • ScheduledExecutorScheduler

      public ScheduledExecutorScheduler(String name, boolean daemon)
    • ScheduledExecutorScheduler

      public ScheduledExecutorScheduler(@Name("name") String name, @Name("daemon") boolean daemon, @Name("threads") int threads)
    • ScheduledExecutorScheduler

      public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader classLoader)
    • ScheduledExecutorScheduler

      public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader classLoader, ThreadGroup threadGroup)
    • ScheduledExecutorScheduler

      public ScheduledExecutorScheduler(@Name("name") String name, @Name("daemon") boolean daemon, @Name("classLoader") ClassLoader classLoader, @Name("threadGroup") ThreadGroup threadGroup, @Name("threads") int threads)
      Parameters:
      name - The name of the scheduler threads or null for automatic name
      daemon - True if scheduler threads should be daemon
      classLoader - The classloader to run the threads with or null to use the current thread context classloader
      threadGroup - The threadgroup to use or null for no thread group
      threads - The number of threads to pass to the core ScheduledExecutorService or -1 for a heuristic determined number of threads.
    • ScheduledExecutorScheduler

      public ScheduledExecutorScheduler(ScheduledExecutorService scheduledExecutorService)
      Parameters:
      scheduledExecutorService - the core ScheduledExecutorService to be used
  • Method Details