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(org.apache.flink.core.memory.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,
org.apache.flink.api.common.typeinfo.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 org.apache.flink.api.common.state.State> |
getPartitionedState(org.apache.flink.api.common.state.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(org.apache.flink.runtime.state.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(org.apache.flink.core.memory.DataInputView in,
ClassLoader userClassloader)
throws Exception
Exceptionpublic long getCurrentWatermark()
Trigger.TriggerContextgetCurrentWatermark in interface Trigger.TriggerContextprotected void writeToState(org.apache.flink.runtime.state.AbstractStateBackend.CheckpointStateOutputView out)
throws IOException
IOExceptionpublic <S extends Serializable> org.apache.flink.api.common.state.ValueState<S> getKeyValueState(String name, Class<S> stateType, S defaultState)
Trigger.TriggerContextValueState 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.TriggerContextS - 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> org.apache.flink.api.common.state.ValueState<S> getKeyValueState(String name, org.apache.flink.api.common.typeinfo.TypeInformation<S> stateType, S defaultState)
Trigger.TriggerContextValueState 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.TriggerContextS - 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 org.apache.flink.api.common.state.State> S getPartitionedState(org.apache.flink.api.common.state.StateDescriptor<S,?> stateDescriptor)
Trigger.TriggerContextState 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.TriggerContextS - 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.TriggerContextTrigger.onProcessingTime(long, Window, TriggerContext) is called with the time specified here.registerProcessingTimeTimer in interface Trigger.TriggerContexttime - The time at which to invoke Trigger.onProcessingTime(long, Window, TriggerContext)public void registerEventTimeTimer(long time)
Trigger.TriggerContextTrigger.onEventTime(long, Window, TriggerContext) is called with the time specified here.registerEventTimeTimer in interface Trigger.TriggerContexttime - The watermark at which to invoke Trigger.onEventTime(long, Window, TriggerContext)Watermarkpublic void deleteProcessingTimeTimer(long time)
Trigger.TriggerContextdeleteProcessingTimeTimer in interface Trigger.TriggerContextpublic void deleteEventTimeTimer(long time)
Trigger.TriggerContextdeleteEventTimeTimer in interface Trigger.TriggerContextpublic TriggerResult onElement(StreamRecord<IN> element) throws Exception
Exceptionpublic TriggerResult onProcessingTime(long time) throws Exception
Exceptionpublic TriggerResult onEventTime(long time) throws Exception
ExceptionCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.