Class ScheduledExecutors

java.lang.Object
org.apache.druid.java.util.common.concurrent.ScheduledExecutors

public class ScheduledExecutors extends Object
  • Constructor Details

    • ScheduledExecutors

      public ScheduledExecutors()
  • Method Details

    • scheduleWithFixedDelay

      public static void scheduleWithFixedDelay(ScheduledExecutorService exec, org.joda.time.Duration initialDelay, org.joda.time.Duration delay, Runnable runnable)
      Run runnable repeatedly with the given delay between calls, after the given initial delay. Exceptions are caught and logged as errors.
    • scheduleWithFixedDelay

      public static void scheduleWithFixedDelay(ScheduledExecutorService exec, org.joda.time.Duration initialDelay, org.joda.time.Duration delay, Callable<ScheduledExecutors.Signal> callable)
      Run callable repeatedly with the given delay between calls, until it returns Signal.STOP. Exceptions are caught and logged as errors.
    • scheduleAtFixedRate

      public static void scheduleAtFixedRate(ScheduledExecutorService exec, org.joda.time.Duration initialDelay, org.joda.time.Duration period, Runnable runnable)
      Run runnable once every period, after the given initial delay. Exceptions are caught and logged as errors.
    • scheduleAtFixedRate

      public static void scheduleAtFixedRate(ScheduledExecutorService exec, org.joda.time.Duration rate, Callable<ScheduledExecutors.Signal> callable)
    • scheduleAtFixedRate

      public static void scheduleAtFixedRate(ScheduledExecutorService exec, org.joda.time.Duration initialDelay, org.joda.time.Duration rate, Callable<ScheduledExecutors.Signal> callable)
    • createFactory

      public static ScheduledExecutorFactory createFactory(Lifecycle lifecycle)
    • fixed

      public static ScheduledExecutorService fixed(int corePoolSize, String nameFormat)
      Creates a new ScheduledExecutorService with a minimum number of threads.
      Parameters:
      corePoolSize - the minimum number of threads in the pool
      nameFormat - the naming format for threads created by the pool
      Returns:
      a new ScheduledExecutorService with the specified configuration
    • fixedWithKeepAliveTime

      public static ScheduledThreadPoolExecutor fixedWithKeepAliveTime(int corePoolSize, String nameFormat, long keepAliveTimeInMillis)
      Creates a new ScheduledExecutorService with a minimum number of threads along with a keep-alive time for idle non-core threads.