K
- Type of the keypublic class DefaultTimerService<K> extends Object implements TimerService<K>
Constructor and Description |
---|
DefaultTimerService(ScheduledExecutorService scheduledExecutorService,
long shutdownTimeout) |
Modifier and Type | Method and Description |
---|---|
boolean |
isValid(K key,
UUID ticket)
Check whether the timeout for the given key and ticket is still valid (not yet unregistered
and not yet overwritten).
|
void |
registerTimeout(K key,
long delay,
TimeUnit unit)
Register a timeout for the given key which shall occur in the given delay.
|
void |
start(TimeoutListener<K> initialTimeoutListener)
Starts this timer service.
|
void |
stop()
Stops this timer service.
|
protected void |
unregisterAllTimeouts()
Unregister all timeouts.
|
void |
unregisterTimeout(K key)
Unregister the timeout for the given key.
|
public DefaultTimerService(ScheduledExecutorService scheduledExecutorService, long shutdownTimeout)
public void start(TimeoutListener<K> initialTimeoutListener)
TimerService
start
in interface TimerService<K>
initialTimeoutListener
- listener for timeouts that have firedpublic void stop()
TimerService
stop
in interface TimerService<K>
public void registerTimeout(K key, long delay, TimeUnit unit)
TimerService
registerTimeout
in interface TimerService<K>
key
- for which to register the timeoutdelay
- until the timeoutunit
- of the timeout delaypublic void unregisterTimeout(K key)
TimerService
unregisterTimeout
in interface TimerService<K>
key
- for which to unregister the timeoutprotected void unregisterAllTimeouts()
public boolean isValid(K key, UUID ticket)
TimerService
isValid
in interface TimerService<K>
key
- for which to check the timeoutticket
- of the timeoutCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.