protected class NonKeyedWindowOperator.Context extends Object implements Trigger.TriggerContext
Context
is responsible for keeping track of the state of one pane.
A pane is the bucket of elements that have the same key (assigned by the
KeySelector
) and same Window
. An element can
be in multiple panes of it was assigned to multiple windows by the
WindowAssigner
. These panes all
have their own instance of the Trigger
.
Modifier and Type | Field and Description |
---|---|
protected long |
processingTimeTimer |
protected HashMap<String,Serializable> |
state |
protected long |
watermarkTimer |
protected W |
window |
protected WindowBuffer<IN,ACC> |
windowBuffer |
Modifier | Constructor and Description |
---|---|
protected |
Context(DataInputView in,
ClassLoader userClassloader) |
|
Context(W window,
WindowBuffer<IN,ACC> windowBuffer) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
deleteEventTimeTimer(long time)
Delete the event-time trigger for the given time.
|
void |
deleteProcessingTimeTimer(long time)
Delete the processing time trigger for the given time.
|
long |
getCurrentWatermark()
Returns the current watermark time.
|
<S extends Serializable> |
getKeyValueState(String name,
Class<S> stateType,
S defaultState)
Retrieves a
ValueState object that can be used to interact with
fault-tolerant state that is scoped to the window and key of the current
trigger invocation. |
<S extends Serializable> |
getKeyValueState(String name,
TypeInformation<S> stateType,
S defaultState)
Retrieves a
ValueState object that can be used to interact with
fault-tolerant state that is scoped to the window and key of the current
trigger invocation. |
<S extends State> |
getPartitionedState(StateDescriptor<S,?> stateDescriptor)
Retrieves an
State object that can be used to interact with
fault-tolerant state that is scoped to the window and key of the current
trigger invocation. |
TriggerResult |
onElement(StreamRecord<IN> element) |
TriggerResult |
onEventTime(long time) |
TriggerResult |
onProcessingTime(long time) |
void |
registerEventTimeTimer(long time)
Register an event-time callback.
|
void |
registerProcessingTimeTimer(long time)
Register a system time callback.
|
protected void |
writeToState(AbstractStateBackend.CheckpointStateOutputView out) |
protected WindowBuffer<IN,ACC> windowBuffer
protected HashMap<String,Serializable> state
protected long watermarkTimer
protected long processingTimeTimer
public Context(W window, WindowBuffer<IN,ACC> windowBuffer)
protected Context(DataInputView in, ClassLoader userClassloader) throws Exception
Exception
public long getCurrentWatermark()
Trigger.TriggerContext
getCurrentWatermark
in interface Trigger.TriggerContext
protected void writeToState(AbstractStateBackend.CheckpointStateOutputView out) throws IOException
IOException
public <S extends Serializable> ValueState<S> getKeyValueState(String name, Class<S> stateType, S defaultState)
Trigger.TriggerContext
ValueState
object that can be used to interact with
fault-tolerant state that is scoped to the window and key of the current
trigger invocation.getKeyValueState
in interface Trigger.TriggerContext
S
- The type of the state.name
- The name of the key/value state.stateType
- The class of the type that is stored in the state. Used to generate
serializers for managed memory and checkpointing.defaultState
- The default state value, returned when the state is accessed and
no value has yet been set for the key. May be null.public <S extends Serializable> ValueState<S> getKeyValueState(String name, TypeInformation<S> stateType, S defaultState)
Trigger.TriggerContext
ValueState
object that can be used to interact with
fault-tolerant state that is scoped to the window and key of the current
trigger invocation.getKeyValueState
in interface Trigger.TriggerContext
S
- The type of the state.name
- The name of the key/value state.stateType
- The type information for the type that is stored in the state.
Used to create serializers for managed memory and checkpoints.defaultState
- The default state value, returned when the state is accessed and
no value has yet been set for the key. May be null.public <S extends State> S getPartitionedState(StateDescriptor<S,?> stateDescriptor)
Trigger.TriggerContext
State
object that can be used to interact with
fault-tolerant state that is scoped to the window and key of the current
trigger invocation.getPartitionedState
in interface Trigger.TriggerContext
S
- The type of the state.stateDescriptor
- The StateDescriptor that contains the name and type of the
state that is being accessed.public void registerProcessingTimeTimer(long time)
Trigger.TriggerContext
Trigger.onProcessingTime(long, Window, TriggerContext)
is called with the time specified here.registerProcessingTimeTimer
in interface Trigger.TriggerContext
time
- The time at which to invoke Trigger.onProcessingTime(long, Window, TriggerContext)
public void registerEventTimeTimer(long time)
Trigger.TriggerContext
Trigger.onEventTime(long, Window, TriggerContext)
is called with the time specified here.registerEventTimeTimer
in interface Trigger.TriggerContext
time
- The watermark at which to invoke Trigger.onEventTime(long, Window, TriggerContext)
Watermark
public void deleteProcessingTimeTimer(long time)
Trigger.TriggerContext
deleteProcessingTimeTimer
in interface Trigger.TriggerContext
public void deleteEventTimeTimer(long time)
Trigger.TriggerContext
deleteEventTimeTimer
in interface Trigger.TriggerContext
public TriggerResult onElement(StreamRecord<IN> element) throws Exception
Exception
public TriggerResult onProcessingTime(long time) throws Exception
Exception
public TriggerResult onEventTime(long time) throws Exception
Exception
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.