public class CloseableScheduledExecutorService extends CloseableExecutorService
CloseableExecutorService.InternalFutureTask<T>, CloseableExecutorService.InternalScheduledFutureTask
isOpen
Constructor and Description |
---|
CloseableScheduledExecutorService(ScheduledExecutorService scheduledExecutorService) |
CloseableScheduledExecutorService(ScheduledExecutorService scheduledExecutorService,
boolean shutdownOnClose) |
Modifier and Type | Method and Description |
---|---|
Future<?> |
schedule(Runnable task,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled
after the given delay.
|
Future<?> |
scheduleWithFixedDelay(Runnable task,
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.
|
close, isShutdown, submit, submit
public CloseableScheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
scheduledExecutorService
- the service to decoratepublic CloseableScheduledExecutorService(ScheduledExecutorService scheduledExecutorService, boolean shutdownOnClose)
scheduledExecutorService
- the service to decorateshutdownOnClose
- if true, shutdown the executor service when this is closedpublic Future<?> schedule(Runnable task, long delay, TimeUnit unit)
task
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterpublic Future<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit)
task
- 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 parametersCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.