Class DefaultTimerService<K>
java.lang.Object
org.apache.flink.runtime.taskexecutor.slot.DefaultTimerService<K>
- Type Parameters:
K- Type of the key
- All Implemented Interfaces:
TimerService<K>
Service to register timeouts for a given key. The timeouts are identified by a ticket so that
newly registered timeouts for the same key can be distinguished from older timeouts.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTimerService(ScheduledExecutorService scheduledExecutorService, long shutdownTimeout) -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck whether the timeout for the given key and ticket is still valid (not yet unregistered and not yet overwritten).voidregisterTimeout(K key, long delay, TimeUnit unit) Register a timeout for the given key which shall occur in the given delay.voidstart(TimeoutListener<K> initialTimeoutListener) Starts this timer service.voidstop()Stops this timer service.protected voidUnregister all timeouts.voidunregisterTimeout(K key) Unregister the timeout for the given key.
-
Constructor Details
-
DefaultTimerService
-
-
Method Details
-
start
Description copied from interface:TimerServiceStarts this timer service.- Specified by:
startin interfaceTimerService<K>- Parameters:
initialTimeoutListener- listener for timeouts that have fired
-
stop
public void stop()Description copied from interface:TimerServiceStops this timer service.- Specified by:
stopin interfaceTimerService<K>
-
registerTimeout
Description copied from interface:TimerServiceRegister a timeout for the given key which shall occur in the given delay.- Specified by:
registerTimeoutin interfaceTimerService<K>- Parameters:
key- for which to register the timeoutdelay- until the timeoutunit- of the timeout delay
-
unregisterTimeout
Description copied from interface:TimerServiceUnregister the timeout for the given key.- Specified by:
unregisterTimeoutin interfaceTimerService<K>- Parameters:
key- for which to unregister the timeout
-
unregisterAllTimeouts
protected void unregisterAllTimeouts()Unregister all timeouts. -
isValid
Description copied from interface:TimerServiceCheck whether the timeout for the given key and ticket is still valid (not yet unregistered and not yet overwritten).- Specified by:
isValidin interfaceTimerService<K>- Parameters:
key- for which to check the timeoutticket- of the timeout- Returns:
- True if the timeout ticket is still valid; otherwise false
-