public class InternalTimerServiceImpl<K,N> extends Object implements InternalTimerService<N>
InternalTimerService
that stores timers on the Java heap.Modifier and Type | Method and Description |
---|---|
void |
advanceWatermark(long time) |
long |
currentProcessingTime()
Returns the current processing time.
|
long |
currentWatermark()
Returns the current event-time watermark.
|
void |
deleteEventTimeTimer(N namespace,
long time)
Deletes the timer for the given key and namespace.
|
void |
deleteProcessingTimeTimer(N namespace,
long time)
Deletes the timer for the given key and namespace.
|
void |
forEachEventTimeTimer(BiConsumerWithException<N,Long,Exception> consumer)
Performs an action for each registered timer.
|
void |
forEachProcessingTimeTimer(BiConsumerWithException<N,Long,Exception> consumer)
Performs an action for each registered timer.
|
TypeSerializer<K> |
getKeySerializer() |
TypeSerializer<N> |
getNamespaceSerializer() |
int |
numEventTimeTimers() |
int |
numEventTimeTimers(N namespace) |
int |
numProcessingTimeTimers() |
int |
numProcessingTimeTimers(N namespace) |
void |
registerEventTimeTimer(N namespace,
long time)
Registers a timer to be fired when event time watermark passes the given time.
|
void |
registerProcessingTimeTimer(N namespace,
long time)
Registers a timer to be fired when processing time passes the given time.
|
void |
restoreTimersForKeyGroup(InternalTimersSnapshot<?,?> restoredSnapshot,
int keyGroupIdx)
Restore the timers (both processing and event time ones) for a given
keyGroupIdx . |
InternalTimersSnapshot<K,N> |
snapshotTimersForKeyGroup(int keyGroupIdx)
Snapshots the timers (both processing and event time ones) for a given
keyGroupIdx . |
void |
startTimerService(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
Triggerable<K,N> triggerTarget)
Starts the local
InternalTimerServiceImpl by:
Setting the keySerialized and namespaceSerializer for the timers it
will contain. |
public void startTimerService(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, Triggerable<K,N> triggerTarget)
InternalTimerServiceImpl
by:
keySerialized
and namespaceSerializer
for the timers it
will contain.
triggerTarget
which contains the action to be performed when a
timer fires.
This method can be called multiple times, as long as it is called with the same serializers.
public long currentProcessingTime()
InternalTimerService
currentProcessingTime
in interface InternalTimerService<N>
public long currentWatermark()
InternalTimerService
currentWatermark
in interface InternalTimerService<N>
public void registerProcessingTimeTimer(N namespace, long time)
InternalTimerService
registerProcessingTimeTimer
in interface InternalTimerService<N>
public void registerEventTimeTimer(N namespace, long time)
InternalTimerService
registerEventTimeTimer
in interface InternalTimerService<N>
public void deleteProcessingTimeTimer(N namespace, long time)
InternalTimerService
deleteProcessingTimeTimer
in interface InternalTimerService<N>
public void deleteEventTimeTimer(N namespace, long time)
InternalTimerService
deleteEventTimeTimer
in interface InternalTimerService<N>
public void forEachEventTimeTimer(BiConsumerWithException<N,Long,Exception> consumer) throws Exception
InternalTimerService
forEachEventTimeTimer
in interface InternalTimerService<N>
Exception
public void forEachProcessingTimeTimer(BiConsumerWithException<N,Long,Exception> consumer) throws Exception
InternalTimerService
forEachProcessingTimeTimer
in interface InternalTimerService<N>
Exception
public InternalTimersSnapshot<K,N> snapshotTimersForKeyGroup(int keyGroupIdx)
keyGroupIdx
.keyGroupIdx
- the id of the key-group to be put in the snapshot.public TypeSerializer<K> getKeySerializer()
public TypeSerializer<N> getNamespaceSerializer()
public void restoreTimersForKeyGroup(InternalTimersSnapshot<?,?> restoredSnapshot, int keyGroupIdx)
keyGroupIdx
.restoredSnapshot
- the restored snapshot containing the key-group's timers, and the
serializers that were used to write themkeyGroupIdx
- the id of the key-group to be put in the snapshot.@VisibleForTesting public int numProcessingTimeTimers()
@VisibleForTesting public int numEventTimeTimers()
@VisibleForTesting public int numProcessingTimeTimers(N namespace)
@VisibleForTesting public int numEventTimeTimers(N namespace)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.