Class ScheduledExecutors
java.lang.Object
org.apache.druid.java.util.common.concurrent.ScheduledExecutors
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ScheduledExecutorFactorycreateFactory(Lifecycle lifecycle) static ScheduledExecutorServiceCreates a newScheduledExecutorServicewith a minimum number of threads.static ScheduledThreadPoolExecutorfixedWithKeepAliveTime(int corePoolSize, String nameFormat, long keepAliveTimeInMillis) Creates a newScheduledExecutorServicewith a minimum number of threads along with a keep-alive time for idle non-core threads.static voidscheduleAtFixedRate(ScheduledExecutorService exec, org.joda.time.Duration rate, Callable<ScheduledExecutors.Signal> callable) static voidscheduleAtFixedRate(ScheduledExecutorService exec, org.joda.time.Duration initialDelay, org.joda.time.Duration period, Runnable runnable) Run runnable once every period, after the given initial delay.static voidscheduleAtFixedRate(ScheduledExecutorService exec, org.joda.time.Duration initialDelay, org.joda.time.Duration rate, Callable<ScheduledExecutors.Signal> callable) static voidscheduleWithFixedDelay(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.static voidscheduleWithFixedDelay(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.
-
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
-
fixed
Creates a newScheduledExecutorServicewith a minimum number of threads.- Parameters:
corePoolSize- the minimum number of threads in the poolnameFormat- the naming format for threads created by the pool- Returns:
- a new
ScheduledExecutorServicewith the specified configuration
-
fixedWithKeepAliveTime
public static ScheduledThreadPoolExecutor fixedWithKeepAliveTime(int corePoolSize, String nameFormat, long keepAliveTimeInMillis) Creates a newScheduledExecutorServicewith a minimum number of threads along with a keep-alive time for idle non-core threads.
-