public static interface Trigger.TriggerContext
Trigger
methods to allow them to register timer
callbacks and deal with state.限定符和类型 | 方法和说明 |
---|---|
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 |
getCurrentProcessingTime()
Returns the current processing time.
|
long |
getCurrentWatermark()
Returns the current watermark time.
|
<S extends Serializable> |
getKeyValueState(String name,
Class<S> stateType,
S defaultState)
已过时。
|
<S extends Serializable> |
getKeyValueState(String name,
org.apache.flink.api.common.typeinfo.TypeInformation<S> stateType,
S defaultState)
已过时。
|
org.apache.flink.metrics.MetricGroup |
getMetricGroup()
Returns the metric group for this
Trigger . |
<S extends org.apache.flink.api.common.state.State> |
getPartitionedState(org.apache.flink.api.common.state.StateDescriptor<S,?> stateDescriptor)
Retrieves a
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. |
void |
registerEventTimeTimer(long time)
Register an event-time callback.
|
void |
registerProcessingTimeTimer(long time)
Register a system time callback.
|
long getCurrentProcessingTime()
org.apache.flink.metrics.MetricGroup getMetricGroup()
Trigger
. This is the same metric
group that would be returned from RuntimeContext.getMetricGroup()
in a user
function.
You must not call methods that create metric objects
(such as MetricGroup.counter(int)
multiple times but instead call once
and store the metric object in a field.
long getCurrentWatermark()
void registerProcessingTimeTimer(long time)
Trigger.onProcessingTime(long, Window, TriggerContext)
is called with the time specified here.time
- The time at which to invoke Trigger.onProcessingTime(long, Window, TriggerContext)
void registerEventTimeTimer(long time)
Trigger.onEventTime(long, Window, TriggerContext)
is called with the time specified here.time
- The watermark at which to invoke Trigger.onEventTime(long, Window, TriggerContext)
Watermark
void deleteProcessingTimeTimer(long time)
void deleteEventTimeTimer(long time)
<S extends org.apache.flink.api.common.state.State> S getPartitionedState(org.apache.flink.api.common.state.StateDescriptor<S,?> stateDescriptor)
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.S
- The type of the state.stateDescriptor
- The StateDescriptor that contains the name and type of the
state that is being accessed.UnsupportedOperationException
- Thrown, if no partitioned state is available for the
function (function is not part os a KeyedStream).@Deprecated <S extends Serializable> org.apache.flink.api.common.state.ValueState<S> getKeyValueState(String name, Class<S> stateType, S defaultState)
getPartitionedState(StateDescriptor)
.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
- 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.UnsupportedOperationException
- Thrown, if no partitioned state is available for the
function (function is not part os a KeyedStream).@Deprecated <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)
getPartitionedState(StateDescriptor)
.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
- 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.UnsupportedOperationException
- Thrown, if no partitioned state is available for the
function (function is not part os a KeyedStream).Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.