@Internal public interface TimerService extends ProcessingTimeService
The registration of timers follows a life cycle of three phases:
quiesce()
, further calls to
ProcessingTimeService.registerTimer(long, ProcessingTimeCallback)
will not register any further timers, and will
return a "dummy" future as a result. This is used for clean shutdown, where currently firing
timers are waited for and no future timers can be scheduled, without causing hard exceptions.shutdownService()
, all calls to ProcessingTimeService.registerTimer(long, ProcessingTimeCallback)
will result in a hard exception.限定符和类型 | 方法和说明 |
---|---|
void |
awaitPendingAfterQuiesce()
This method can be used after calling
quiesce() , and awaits the completion
of currently executing timers. |
boolean |
isTerminated()
Returns true if the service has been shut down, false otherwise.
|
void |
quiesce()
This method puts the service into a state where it does not register new timers, but
returns for each call to
ProcessingTimeService.registerTimer(long, ProcessingTimeCallback) only a "mock" future. |
void |
shutdownService()
Shuts down and clean up the timer service provider hard and immediately.
|
boolean |
shutdownServiceUninterruptible(long timeoutMs)
Shuts down and clean up the timer service provider hard and immediately.
|
getCurrentProcessingTime, registerTimer, scheduleAtFixedRate
boolean isTerminated()
void quiesce() throws InterruptedException
ProcessingTimeService.registerTimer(long, ProcessingTimeCallback)
only a "mock" future.
Furthermore, the method clears all not yet started timers.
This method can be used to cleanly shut down the timer service. The using components will not notice that the service is shut down (as for example via exceptions when registering a new timer), but the service will simply not fire any timer any more.
void awaitPendingAfterQuiesce() throws InterruptedException
quiesce()
, and awaits the completion
of currently executing timers.void shutdownService()
ProcessingTimeService.registerTimer(long, ProcessingTimeCallback)
will result in a hard exception.boolean shutdownServiceUninterruptible(long timeoutMs)
ProcessingTimeService.registerTimer(long, ProcessingTimeCallback)
will result in a hard exception. This call cannot be interrupted and will block until the shutdown is completed
or the timeout is exceeded.timeoutMs
- timeout for blocking on the service shutdown in milliseconds.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.