K
- The type of keys used for the timers and the registry.N
- The type of namespace used for the timers.@Internal public class InternalTimeServiceManager<K,N> extends Object
AbstractStreamOperator
. Right now, this is only a
timer services
.
NOTE: These services are only available to keyed operators.Modifier and Type | Method and Description |
---|---|
void |
advanceWatermark(Watermark watermark) |
InternalTimerService<N> |
getInternalTimerService(String name,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
Triggerable<K,N> triggerable)
Returns a
InternalTimerService that can be used to query current processing time
and event time and to set timers. |
int |
numEventTimeTimers() |
int |
numProcessingTimeTimers() |
void |
restoreStateForKeyGroup(InputStream stream,
int keyGroupIdx,
ClassLoader userCodeClassLoader) |
void |
snapshotStateForKeyGroup(DataOutputView stream,
int keyGroupIdx) |
public InternalTimerService<N> getInternalTimerService(String name, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, Triggerable<K,N> triggerable)
InternalTimerService
that can be used to query current processing time
and event time and to set timers. An operator can have several timer services, where
each has its own namespace serializer. Timer services are differentiated by the string
key that is given when requesting them, if you call this method with the same key
multiple times you will get the same timer service instance in subsequent requests.
Timers are always scoped to a key, the currently active key of a keyed stream operation. When a timer fires, this key will also be set as the currently active key.
Each timer has attached metadata, the namespace. Different timer services
can have a different namespace type. If you don't need namespace differentiation you
can use VoidNamespaceSerializer
as the namespace serializer.
name
- The name of the requested timer service. If no service exists under the given
name a new one will be created and returned.keySerializer
- TypeSerializer
for the timer keys.namespaceSerializer
- TypeSerializer
for the timer namespace.triggerable
- The Triggerable
that should be invoked when timers firepublic void advanceWatermark(Watermark watermark) throws Exception
Exception
public void snapshotStateForKeyGroup(DataOutputView stream, int keyGroupIdx) throws IOException
IOException
public void restoreStateForKeyGroup(InputStream stream, int keyGroupIdx, ClassLoader userCodeClassLoader) throws IOException
IOException
@VisibleForTesting public int numProcessingTimeTimers()
@VisibleForTesting public int numEventTimeTimers()
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.