本文整理汇总了Java中org.apache.flink.streaming.api.windowing.time.Time.toMilliseconds方法的典型用法代码示例。如果您正苦于以下问题:Java Time.toMilliseconds方法的具体用法?Java Time.toMilliseconds怎么用?Java Time.toMilliseconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.streaming.api.windowing.time.Time
的用法示例。
在下文中一共展示了Time.toMilliseconds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMiddleStates
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates all the states between Start and Final state.
*
* @param sinkState the state that last state should point to (always the Final state)
* @return the next state after Start in the resulting graph
*/
private State<T> createMiddleStates(final State<T> sinkState) {
State<T> lastSink = sinkState;
while (currentPattern.getPrevious() != null) {
if (currentPattern.getQuantifier().getConsumingStrategy() == Quantifier.ConsumingStrategy.NOT_FOLLOW) {
//skip notFollow patterns, they are converted into edge conditions
} else if (currentPattern.getQuantifier().getConsumingStrategy() == Quantifier.ConsumingStrategy.NOT_NEXT) {
final State<T> notNext = createState(currentPattern.getName(), State.StateType.Normal);
final IterativeCondition<T> notCondition = getTakeCondition(currentPattern);
final State<T> stopState = createStopState(notCondition, currentPattern.getName());
if (lastSink.isFinal()) {
//so that the proceed to final is not fired
notNext.addIgnore(lastSink, new NotCondition<>(notCondition));
} else {
notNext.addProceed(lastSink, new NotCondition<>(notCondition));
}
notNext.addProceed(stopState, notCondition);
lastSink = notNext;
} else {
lastSink = convertPattern(lastSink);
}
// we traverse the pattern graph backwards
followingPattern = currentPattern;
currentPattern = currentPattern.getPrevious();
final Time currentWindowTime = currentPattern.getWindowTime();
if (currentWindowTime != null && currentWindowTime.toMilliseconds() < windowTime) {
// the window time is the global minimum of all window times of each state
windowTime = currentWindowTime.toMilliseconds();
}
}
return lastSink;
}
示例2: BoundedOutOfOrdernessTimestampExtractor
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
public BoundedOutOfOrdernessTimestampExtractor(Time maxOutOfOrderness) {
if (maxOutOfOrderness.toMilliseconds() < 0) {
throw new RuntimeException("Tried to set the maximum allowed " +
"lateness to " + maxOutOfOrderness + ". This parameter cannot be negative.");
}
this.maxOutOfOrderness = maxOutOfOrderness.toMilliseconds();
this.currentMaxTimestamp = Long.MIN_VALUE + this.maxOutOfOrderness;
}
示例3: allowedLateness
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Sets the time by which elements are allowed to be late. Elements that
* arrive behind the watermark by more than the specified time will be dropped.
* By default, the allowed lateness is {@code 0L}.
*
* <p>Setting an allowed lateness is only valid for event-time windows.
*/
@PublicEvolving
public AllWindowedStream<T, W> allowedLateness(Time lateness) {
final long millis = lateness.toMilliseconds();
checkArgument(millis >= 0, "The allowed lateness cannot be negative.");
this.allowedLateness = millis;
return this;
}
示例4: withGap
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code SessionWindows} {@link WindowAssigner} that assigns
* elements to sessions based on the element timestamp.
*
* @param size The session timeout, i.e. the time gap between sessions
* @return The policy.
*/
public static EventTimeSessionWindows withGap(Time size) {
return new EventTimeSessionWindows(size.toMilliseconds());
}
示例5: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code TumblingEventTimeWindows} {@link WindowAssigner} that assigns
* elements to time windows based on the element timestamp.
*
* @param size The size of the generated windows.
* @return The time policy.
*/
public static TumblingEventTimeWindows of(Time size) {
return new TumblingEventTimeWindows(size.toMilliseconds(), 0);
}
示例6: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code SlidingTimeWindows} {@link WindowAssigner} that assigns
* elements to sliding time windows based on the element timestamp.
*
* @deprecated Please use {@link SlidingEventTimeWindows#of(Time, Time)}.
*
* @param size The size of the generated windows.
* @param slide The slide interval of the generated windows.
* @return The time policy.
*/
@Deprecated()
public static SlidingTimeWindows of(Time size, Time slide) {
return new SlidingTimeWindows(size.toMilliseconds(), slide.toMilliseconds());
}
示例7: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code SlidingProcessingTimeWindows} {@link WindowAssigner} that assigns
* elements to sliding time windows based on the element timestamp.
*
* @param size The size of the generated windows.
* @param slide The slide interval of the generated windows.
* @return The time policy.
*/
public static SlidingProcessingTimeWindows of(Time size, Time slide) {
return new SlidingProcessingTimeWindows(size.toMilliseconds(), slide.toMilliseconds(), 0);
}
示例8: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code TumblingAlignedProcessingTimeWindows} {@link WindowAssigner} that assigns
* elements to time windows based on the element timestamp.
*
* @param size The size of the generated windows.
*/
public static TumblingAlignedProcessingTimeWindows of(Time size) {
return new TumblingAlignedProcessingTimeWindows(size.toMilliseconds());
}
示例9: withGap
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code SessionWindows} {@link WindowAssigner} that assigns
* elements to sessions based on the element timestamp.
*
* @param size The session timeout, i.e. the time gap between sessions
* @return The policy.
*/
public static ProcessingTimeSessionWindows withGap(Time size) {
return new ProcessingTimeSessionWindows(size.toMilliseconds());
}
示例10: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code TumblingTimeWindows} {@link WindowAssigner} that assigns
* elements to time windows based on the element timestamp.
*
* @deprecated Please use {@link TumblingEventTimeWindows#of(Time)}.
*
* @param size The size of the generated windows.
* @return The time policy.
*/
@Deprecated()
public static TumblingTimeWindows of(Time size) {
return new TumblingTimeWindows(size.toMilliseconds());
}
示例11: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code SlidingEventTimeWindows} {@link WindowAssigner} that assigns
* elements to sliding time windows based on the element timestamp.
*
* @param size The size of the generated windows.
* @param slide The slide interval of the generated windows.
* @return The time policy.
*/
public static SlidingEventTimeWindows of(Time size, Time slide) {
return new SlidingEventTimeWindows(size.toMilliseconds(), slide.toMilliseconds(), 0);
}
示例12: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code SlidingAlignedProcessingTimeWindows} {@link WindowAssigner} that assigns
* elements to sliding time windows based on the element timestamp.
*
* @param size The size of the generated windows.
* @param slide The slide interval of the generated windows.
*/
public static SlidingAlignedProcessingTimeWindows of(Time size, Time slide) {
return new SlidingAlignedProcessingTimeWindows(size.toMilliseconds(), slide.toMilliseconds());
}
示例13: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a trigger that continuously fires based on the given interval.
*
* @param interval The time interval at which to fire.
* @param <W> The type of {@link Window Windows} on which this trigger can operate.
*/
public static <W extends Window> ContinuousProcessingTimeTrigger<W> of(Time interval) {
return new ContinuousProcessingTimeTrigger<>(interval.toMilliseconds());
}
示例14: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a new {@code TumblingProcessingTimeWindows} {@link WindowAssigner} that assigns
* elements to time windows based on the element timestamp and offset.
*
* <p>For example, if you want window a stream by hour,but window begins at the 15th minutes
* of each hour, you can use {@code of(Time.hours(1),Time.minutes(15))},then you will get
* time windows start at 0:15:00,1:15:00,2:15:00,etc.
*
* <p>Rather than that,if you are living in somewhere which is not using UTC±00:00 time,
* such as China which is using UTC+08:00,and you want a time window with size of one day,
* and window begins at every 00:00:00 of local time,you may use {@code of(Time.days(1),Time.hours(-8))}.
* The parameter of offset is {@code Time.hours(-8))} since UTC+08:00 is 8 hours earlier than UTC time.
*
* @param size The size of the generated windows.
* @param offset The offset which window start would be shifted by.
* @return The time policy.
*/
public static TumblingProcessingTimeWindows of(Time size, Time offset) {
return new TumblingProcessingTimeWindows(size.toMilliseconds(), offset.toMilliseconds());
}
示例15: of
import org.apache.flink.streaming.api.windowing.time.Time; //导入方法依赖的package包/类
/**
* Creates a {@code TimeEvictor} that keeps the given number of elements.
* Eviction is done before the window function.
*
* @param windowSize The amount of time for which to keep elements.
*/
public static <W extends Window> TimeEvictor<W> of(Time windowSize) {
return new TimeEvictor<>(windowSize.toMilliseconds());
}