Class ShutdownableScheduledExecutorServiceImpl<E extends ScheduledExecutorService>
java.lang.Object
java.util.concurrent.AbstractExecutorService
com.linkedin.alpini.base.registry.impl.ShutdownableExecutorServiceImpl<E>
com.linkedin.alpini.base.registry.impl.ShutdownableScheduledExecutorServiceImpl<E>
- All Implemented Interfaces:
ExecutorService,ScheduledExecutorService,Shutdownable,ShutdownableExecutorService,ShutdownableResource,ShutdownableScheduledExecutorService,Executor,ExecutorService,ScheduledExecutorService
public class ShutdownableScheduledExecutorServiceImpl<E extends ScheduledExecutorService>
extends ShutdownableExecutorServiceImpl<E>
implements ShutdownableScheduledExecutorService
-
Field Summary
Fields inherited from class com.linkedin.alpini.base.registry.impl.ShutdownableExecutorServiceImpl
_e -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ScheduledFuture<?>Creates and executes a one-shot action that becomes enabled after the given delay.final <V> ScheduledFuture<V>Creates and executes a ScheduledFuture that becomes enabled after the given delay.final ScheduledFuture<?>scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence afterinitialDelaytheninitialDelay+period, theninitialDelay + 2 * period, and so on.final ScheduledFuture<?>scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.voidshutdown()Starts the shutdown process.Methods inherited from class com.linkedin.alpini.base.registry.impl.ShutdownableExecutorServiceImpl
awaitTermination, execute, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdownNow, submit, submit, submit, unwrap, waitForShutdown, waitForShutdownMethods inherited from class java.util.concurrent.AbstractExecutorService
newTaskFor, newTaskForMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.alpini.base.concurrency.ExecutorService
submit, submit, submitMethods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdownNowMethods inherited from interface com.linkedin.alpini.base.registry.Shutdownable
waitForShutdown, waitForShutdownMethods inherited from interface com.linkedin.alpini.base.registry.ShutdownableExecutorService
unwrapMethods inherited from interface com.linkedin.alpini.base.registry.ShutdownableResource
isShutdown, isTerminated
-
Constructor Details
-
ShutdownableScheduledExecutorServiceImpl
-
-
Method Details
-
shutdown
public void shutdown()Description copied from interface:ShutdownableStarts the shutdown process. It is recommended to perform the actual shutdown activity in a separate thread from the thread that calls shutdown- Specified by:
shutdownin interfaceExecutorService- Specified by:
shutdownin interfaceShutdownable- Overrides:
shutdownin classShutdownableExecutorServiceImpl<E extends ScheduledExecutorService>- See Also:
-
schedule
@Nonnull public final ScheduledFuture<?> schedule(@Nonnull Runnable command, long delay, @Nonnull TimeUnit unit) Description copied from interface:ScheduledExecutorServiceCreates and executes a one-shot action that becomes enabled after the given delay.- Specified by:
schedulein interfaceScheduledExecutorService- Specified by:
schedulein interfaceScheduledExecutorService- Parameters:
command- the task to executedelay- the time from now to delay executionunit- the time unit of the delay parameter- Returns:
- a ScheduledFuture representing pending completion of
the task and whose
get()method will returnnullupon completion - See Also:
-
schedule
@Nonnull public final <V> ScheduledFuture<V> schedule(@Nonnull Callable<V> callable, long delay, @Nonnull TimeUnit unit) Description copied from interface:ScheduledExecutorServiceCreates and executes a ScheduledFuture that becomes enabled after the given delay.- Specified by:
schedulein interfaceScheduledExecutorService- Specified by:
schedulein interfaceScheduledExecutorService- Type Parameters:
V- the type of the callable's result- Parameters:
callable- the function to executedelay- the time from now to delay executionunit- the time unit of the delay parameter- Returns:
- a ScheduledFuture that can be used to extract result or cancel
- See Also:
-
scheduleAtFixedRate
@Nonnull public final ScheduledFuture<?> scheduleAtFixedRate(@Nonnull Runnable command, long initialDelay, long period, @Nonnull TimeUnit unit) Description copied from interface:ScheduledExecutorServiceCreates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence afterinitialDelaytheninitialDelay+period, theninitialDelay + 2 * period, and so on. If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the executor. If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.- Specified by:
scheduleAtFixedRatein interfaceScheduledExecutorService- Specified by:
scheduleAtFixedRatein interfaceScheduledExecutorService- Parameters:
command- the task to executeinitialDelay- the time to delay first executionperiod- the period between successive executionsunit- the time unit of the initialDelay and period parameters- Returns:
- a ScheduledFuture representing pending completion of
the task, and whose
get()method will throw an exception upon cancellation - See Also:
-
scheduleWithFixedDelay
@Nonnull public final ScheduledFuture<?> scheduleWithFixedDelay(@Nonnull Runnable command, long initialDelay, long delay, @Nonnull TimeUnit unit) Description copied from interface:ScheduledExecutorServiceCreates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next. If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the executor.- Specified by:
scheduleWithFixedDelayin interfaceScheduledExecutorService- Specified by:
scheduleWithFixedDelayin interfaceScheduledExecutorService- Parameters:
command- the task to executeinitialDelay- the time to delay first executiondelay- the delay between the termination of one execution and the commencement of the nextunit- the time unit of the initialDelay and delay parameters- Returns:
- a ScheduledFuture representing pending completion of
the task, and whose
get()method will throw an exception upon cancellation - See Also:
-