public static final class ElementTriggers.CountElement<W extends Window> extends Trigger<W>
Trigger that fires at some point after a specified number of
input elements have arrived.Trigger.OnMergeContext, Trigger.TriggerContext| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
canMerge()
Returns true if this trigger supports merging of trigger state and can therefore.
|
void |
clear(W window)
Clears any state that the trigger might still hold for the given window.
|
boolean |
onElement(Object element,
long timestamp,
W window)
Called for every element that gets added to a pane.
|
boolean |
onEventTime(long time,
W window)
Called when an event-time timer that was set using the trigger context fires.
|
void |
onMerge(W window,
Trigger.OnMergeContext mergeContext)
Called when several windows have been merged into one window by the
WindowAssigner. |
boolean |
onProcessingTime(long time,
W window)
Called when a processing-time timer that was set using the trigger context fires.
|
void |
open(Trigger.TriggerContext ctx)
Initialization method for the trigger.
|
String |
toString() |
public void open(Trigger.TriggerContext ctx) throws Exception
Triggerpublic boolean onElement(Object element, long timestamp, W window) throws Exception
Triggerpublic boolean onProcessingTime(long time,
W window)
throws Exception
TriggerNote: This method is not called in case the window does not contain any elements. Thus,
if you return PURGE from a trigger method and you expect to do cleanup in a future
invocation of a timer callback it might be wise to clean any state that you would clean
in the timer callback.
onProcessingTime 在类中 Trigger<W extends Window>time - The timestamp at which the timer fired.window - The window for which the timer fired.Exceptionpublic boolean onEventTime(long time,
W window)
throws Exception
TriggerNote: This method is not called in case the window does not contain any elements. Thus,
if you return PURGE from a trigger method and you expect to do cleanup in a future
invocation of a timer callback it might be wise to clean any state that you would clean
in the timer callback.
onEventTime 在类中 Trigger<W extends Window>time - The timestamp at which the timer fired.window - The window for which the timer fired.Exceptionpublic void clear(W window) throws Exception
TriggerTrigger.TriggerContext.registerEventTimeTimer(long)
and Trigger.TriggerContext.registerProcessingTimeTimer(long) should be deleted here as
well as state acquired using TriggerContext#getPartitionedState(StateDescriptor).public boolean canMerge()
TriggerIf this returns true you must properly implement
Trigger.onMerge(Window, OnMergeContext)
public void onMerge(W window, Trigger.OnMergeContext mergeContext) throws Exception
TriggerWindowAssigner.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.