K
- Type of the keypublic class TimerService<K> extends Object
Constructor and Description |
---|
TimerService(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) |
void |
stop() |
protected void |
unregisterAllTimeouts()
Unregister all timeouts.
|
void |
unregisterTimeout(K key)
Unregister the timeout for the given key.
|
public TimerService(ScheduledExecutorService scheduledExecutorService, long shutdownTimeout)
public void start(TimeoutListener<K> initialTimeoutListener)
public void stop()
public void registerTimeout(K key, long delay, TimeUnit unit)
key
- for which to register the timeoutdelay
- until the timeoutunit
- of the timeout delaypublic void unregisterTimeout(K key)
key
- for which to unregister the timeoutprotected void unregisterAllTimeouts()
public boolean isValid(K key, UUID ticket)
key
- for which to check the timeoutticket
- of the timeoutCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.