Class AsyncWindowOperator.Context
- java.lang.Object
-
- org.apache.flink.runtime.asyncprocessing.operators.windowing.AsyncWindowOperator.Context
-
- All Implemented Interfaces:
AsyncTrigger.OnMergeContext,AsyncTrigger.TriggerContext
public class AsyncWindowOperator.Context extends Object implements AsyncTrigger.OnMergeContext
Contextis a utility for handlingAsyncTriggerinvocations. It can be reused by setting thekeyandwindowfields. No internal state must be kept in theContext
-
-
Field Summary
Fields Modifier and Type Field Description protected DeclaredVariable<W>window
-
Constructor Summary
Constructors Constructor Description Context(DeclaredVariable<W> window)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.flink.api.common.state.v2.StateFuture<Void>clear()voiddeleteEventTimeTimer(long time)Delete the event-time trigger for the given time.voiddeleteProcessingTimeTimer(long time)Delete the processing time trigger for the given time.longgetCurrentProcessingTime()Returns the current processing time.longgetCurrentWatermark()Returns the current watermark time.org.apache.flink.metrics.MetricGroupgetMetricGroup()Returns the metric group for thisAsyncTrigger.<T,S extends org.apache.flink.api.common.state.v2.State>
SgetPartitionedState(org.apache.flink.api.common.state.v2.StateDescriptor<T> stateDescriptor)Retrieves aState(v2) object that can be used to interact with fault-tolerant state that is scoped to the window and key of the current trigger invocation.<T> voidmergePartitionedState(org.apache.flink.api.common.state.v2.StateDescriptor<T> stateDescriptor)org.apache.flink.api.common.state.v2.StateFuture<TriggerResult>onElement(StreamRecord<IN> element)org.apache.flink.api.common.state.v2.StateFuture<TriggerResult>onEventTime(long time)voidonMerge(Collection<W> mergedWindows)org.apache.flink.api.common.state.v2.StateFuture<TriggerResult>onProcessingTime(long time)voidregisterEventTimeTimer(long time)Register an event-time callback.voidregisterProcessingTimeTimer(long time)Register a system time callback.StringtoString()
-
-
-
Field Detail
-
window
protected DeclaredVariable<W extends Window> window
-
-
Constructor Detail
-
Context
public Context(DeclaredVariable<W> window)
-
-
Method Detail
-
getMetricGroup
public org.apache.flink.metrics.MetricGroup getMetricGroup()
Description copied from interface:AsyncTrigger.TriggerContextReturns the metric group for thisAsyncTrigger. This is the same metric group that would be returned fromRuntimeContext.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.- Specified by:
getMetricGroupin interfaceAsyncTrigger.TriggerContext
-
getCurrentWatermark
public long getCurrentWatermark()
Description copied from interface:AsyncTrigger.TriggerContextReturns the current watermark time.- Specified by:
getCurrentWatermarkin interfaceAsyncTrigger.TriggerContext
-
getPartitionedState
public <T,S extends org.apache.flink.api.common.state.v2.State> S getPartitionedState(org.apache.flink.api.common.state.v2.StateDescriptor<T> stateDescriptor)
Description copied from interface:AsyncTrigger.TriggerContextRetrieves aState(v2) object that can be used to interact with fault-tolerant state that is scoped to the window and key of the current trigger invocation.- Specified by:
getPartitionedStatein interfaceAsyncTrigger.TriggerContext- Type Parameters:
T- The store element of the state.- Parameters:
stateDescriptor- The StateDescriptor that contains the name and type of the state that is being accessed.- Returns:
- The partitioned state object.
-
mergePartitionedState
public <T> void mergePartitionedState(org.apache.flink.api.common.state.v2.StateDescriptor<T> stateDescriptor)
- Specified by:
mergePartitionedStatein interfaceAsyncTrigger.OnMergeContext
-
getCurrentProcessingTime
public long getCurrentProcessingTime()
Description copied from interface:AsyncTrigger.TriggerContextReturns the current processing time.- Specified by:
getCurrentProcessingTimein interfaceAsyncTrigger.TriggerContext
-
registerProcessingTimeTimer
public void registerProcessingTimeTimer(long time)
Description copied from interface:AsyncTrigger.TriggerContextRegister a system time callback. When the current system time passes the specified timeAsyncTrigger.onProcessingTime(long, Window, TriggerContext)is called with the time specified here.- Specified by:
registerProcessingTimeTimerin interfaceAsyncTrigger.TriggerContext- Parameters:
time- The time at which to invokeAsyncTrigger.onProcessingTime(long, Window, TriggerContext)
-
registerEventTimeTimer
public void registerEventTimeTimer(long time)
Description copied from interface:AsyncTrigger.TriggerContextRegister an event-time callback. When the current watermark passes the specified timeAsyncTrigger.onEventTime(long, Window, TriggerContext)is called with the time specified here.- Specified by:
registerEventTimeTimerin interfaceAsyncTrigger.TriggerContext- Parameters:
time- The watermark at which to invokeAsyncTrigger.onEventTime(long, Window, AsyncTrigger.TriggerContext)- See Also:
Watermark
-
deleteProcessingTimeTimer
public void deleteProcessingTimeTimer(long time)
Description copied from interface:AsyncTrigger.TriggerContextDelete the processing time trigger for the given time.- Specified by:
deleteProcessingTimeTimerin interfaceAsyncTrigger.TriggerContext
-
deleteEventTimeTimer
public void deleteEventTimeTimer(long time)
Description copied from interface:AsyncTrigger.TriggerContextDelete the event-time trigger for the given time.- Specified by:
deleteEventTimeTimerin interfaceAsyncTrigger.TriggerContext
-
onElement
public org.apache.flink.api.common.state.v2.StateFuture<TriggerResult> onElement(StreamRecord<IN> element) throws Exception
- Throws:
Exception
-
onProcessingTime
public org.apache.flink.api.common.state.v2.StateFuture<TriggerResult> onProcessingTime(long time) throws Exception
- Throws:
Exception
-
onEventTime
public org.apache.flink.api.common.state.v2.StateFuture<TriggerResult> onEventTime(long time) throws Exception
- Throws:
Exception
-
onMerge
public void onMerge(Collection<W> mergedWindows) throws Exception
- Throws:
Exception
-
clear
public org.apache.flink.api.common.state.v2.StateFuture<Void> clear() throws Exception
- Throws:
Exception
-
-