当前位置: 首页>>代码示例>>Java>>正文


Java Watermark.getTimestamp方法代码示例

本文整理汇总了Java中org.apache.flink.streaming.api.watermark.Watermark.getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Java Watermark.getTimestamp方法的具体用法?Java Watermark.getTimestamp怎么用?Java Watermark.getTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.streaming.api.watermark.Watermark的用法示例。


在下文中一共展示了Watermark.getTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateMinPunctuatedWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
/**
 *Checks whether a new per-partition watermark is also a new cross-partition watermark.
 */
private void updateMinPunctuatedWatermark(Watermark nextWatermark) {
	if (nextWatermark.getTimestamp() > maxWatermarkSoFar) {
		long newMin = Long.MAX_VALUE;

		for (KafkaTopicPartitionState<?> state : allPartitions) {
			@SuppressWarnings("unchecked")
			final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
					(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) state;
			
			newMin = Math.min(newMin, withWatermarksState.getCurrentPartitionWatermark());
		}

		// double-check locking pattern
		if (newMin > maxWatermarkSoFar) {
			synchronized (checkpointLock) {
				if (newMin > maxWatermarkSoFar) {
					maxWatermarkSoFar = newMin;
					sourceContext.emitWatermark(new Watermark(newMin));
				}
			}
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:AbstractFetcher.java

示例2: updateMinPunctuatedWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
/**
 *Checks whether a new per-partition watermark is also a new cross-partition watermark.
 */
private void updateMinPunctuatedWatermark(Watermark nextWatermark) {
	if (nextWatermark.getTimestamp() > maxWatermarkSoFar) {
		long newMin = Long.MAX_VALUE;

		for (KafkaTopicPartitionState<?> state : subscribedPartitionStates) {
			@SuppressWarnings("unchecked")
			final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
					(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) state;

			newMin = Math.min(newMin, withWatermarksState.getCurrentPartitionWatermark());
		}

		// double-check locking pattern
		if (newMin > maxWatermarkSoFar) {
			synchronized (checkpointLock) {
				if (newMin > maxWatermarkSoFar) {
					maxWatermarkSoFar = newMin;
					sourceContext.emitWatermark(new Watermark(newMin));
				}
			}
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:AbstractFetcher.java

示例3: processWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
	// we do our own watermark handling, no super call. we will never be able to use
	// the timer service like this, however.

	if (priorityQueue.isEmpty()) {
		advanceTime(nfa, mark.getTimestamp());
	} else {
		while (!priorityQueue.isEmpty() && priorityQueue.peek().getTimestamp() <= mark.getTimestamp()) {
			StreamRecord<IN> streamRecord = priorityQueue.poll();

			processEvent(nfa, streamRecord.getValue(), streamRecord.getTimestamp());
		}
	}

	output.emitWatermark(mark);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:AbstractCEPPatternOperator.java

示例4: processWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
	while (!priorityQueue.isEmpty() && priorityQueue.peek().getTimestamp() <= mark.getTimestamp()) {
		StreamRecord<IN> streamRecord = priorityQueue.poll();
		String streamId = getStreamId(streamRecord.getValue());
		long timestamp = streamRecord.getTimestamp();
		StreamSchema<IN> schema = siddhiPlan.getInputStreamSchema(streamId);
		processEvent(streamId, schema, streamRecord.getValue(), timestamp);
	}
	output.emitWatermark(mark);
}
 
开发者ID:haoch,项目名称:flink-siddhi,代码行数:12,代码来源:AbstractSiddhiOperator.java

示例5: processWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
    while (!priorityQueue.isEmpty() && priorityQueue.peek().getTimestamp() <= mark.getTimestamp()) {
        StreamRecord<IN> streamRecord = priorityQueue.poll();
        String streamId = getStreamId(streamRecord.getValue());
        long timestamp = streamRecord.getTimestamp();
        StreamSchema<IN> schema = siddhiPlan.getInputStreamSchema(streamId);
        processEvent(streamId, schema, streamRecord.getValue(), timestamp);
    }
    output.emitWatermark(mark);
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:12,代码来源:AbstractSiddhiOperator.java

示例6: processWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
	wmCount++;

	if (lastWM <= mark.getTimestamp()) {
		lastWM = mark.getTimestamp();
	} else {
		throw new RuntimeException("Received watermark higher than the last one");
	}

	if (mark.getTimestamp() % 11 != 0 && mark.getTimestamp() != Long.MAX_VALUE) {
		throw new RuntimeException("Invalid watermark: " + mark.getTimestamp());
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:Kafka011ITCase.java

示例7: handleWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void handleWatermark(Watermark watermark) {
	try {
		synchronized (lock) {
			lastEmittedWatermark = watermark.getTimestamp();
			operator.processWatermark(watermark);
		}
	} catch (Exception e) {
		throw new RuntimeException("Exception occurred while processing valve output watermark: ", e);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:StreamInputProcessor.java

示例8: processWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
/**
 * Override the base implementation to completely ignore watermarks propagated from
 * upstream (we rely only on the {@link AssignerWithPunctuatedWatermarks} to emit
 * watermarks from here).
 */
@Override
public void processWatermark(Watermark mark) throws Exception {
	// if we receive a Long.MAX_VALUE watermark we forward it since it is used
	// to signal the end of input and to not block watermark progress downstream
	if (mark.getTimestamp() == Long.MAX_VALUE && currentWatermark != Long.MAX_VALUE) {
		currentWatermark = Long.MAX_VALUE;
		output.emitWatermark(mark);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:TimestampsAndPunctuatedWatermarksOperator.java

示例9: processWatermark1

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
public void processWatermark1(Watermark mark) throws Exception {
	input1Watermark = mark.getTimestamp();
	long newMin = Math.min(input1Watermark, input2Watermark);
	if (newMin > combinedWatermark) {
		combinedWatermark = newMin;
		processWatermark(new Watermark(combinedWatermark));
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:AbstractStreamOperator.java

示例10: processWatermark2

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
public void processWatermark2(Watermark mark) throws Exception {
	input2Watermark = mark.getTimestamp();
	long newMin = Math.min(input1Watermark, input2Watermark);
	if (newMin > combinedWatermark) {
		combinedWatermark = newMin;
		processWatermark(new Watermark(combinedWatermark));
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:AbstractStreamOperator.java

示例11: checkAndGetNewWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Nullable
public Watermark checkAndGetNewWatermark(T record, long timestamp) {
	Watermark mark = timestampsAndWatermarks.checkAndGetNextWatermark(record, timestamp);
	if (mark != null && mark.getTimestamp() > partitionWatermark) {
		partitionWatermark = mark.getTimestamp();
		return mark;
	}
	else {
		return null;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:KafkaTopicPartitionStateWithPunctuatedWatermarks.java

示例12: handleWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void handleWatermark(Watermark watermark) {
	try {
		synchronized (lock) {
			lastEmittedWatermark1 = watermark.getTimestamp();
			operator.processWatermark1(watermark);
		}
	} catch (Exception e) {
		throw new RuntimeException("Exception occurred while processing valve output watermark: ", e);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:StreamTwoInputProcessor.java

示例13: onProcessingTime

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void onProcessingTime(long timestamp) throws Exception {
	// register next timer
	Watermark newWatermark = userFunction.getCurrentWatermark();
	if (newWatermark != null && newWatermark.getTimestamp() > currentWatermark) {
		currentWatermark = newWatermark.getTimestamp();
		// emit watermark
		output.emitWatermark(newWatermark);
	}

	long now = getProcessingTimeService().getCurrentProcessingTime();
	getProcessingTimeService().registerTimer(now + watermarkInterval, this);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:TimestampsAndPeriodicWatermarksOperator.java

示例14: processWatermark

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
/**
 * Override the base implementation to completely ignore watermarks propagated from
 * upstream (we rely only on the {@link AssignerWithPeriodicWatermarks} to emit
 * watermarks from here).
 */
@Override
public void processWatermark(Watermark mark) throws Exception {
	// if we receive a Long.MAX_VALUE watermark we forward it since it is used
	// to signal the end of input and to not block watermark progress downstream
	if (mark.getTimestamp() == Long.MAX_VALUE && currentWatermark != Long.MAX_VALUE) {
		currentWatermark = Long.MAX_VALUE;
		output.emitWatermark(mark);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:TimestampsAndPeriodicWatermarksOperator.java

示例15: close

import org.apache.flink.streaming.api.watermark.Watermark; //导入方法依赖的package包/类
@Override
public void close() throws Exception {
	super.close();

	// emit a final watermark
	Watermark newWatermark = userFunction.getCurrentWatermark();
	if (newWatermark != null && newWatermark.getTimestamp() > currentWatermark) {
		currentWatermark = newWatermark.getTimestamp();
		// emit watermark
		output.emitWatermark(newWatermark);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:TimestampsAndPeriodicWatermarksOperator.java


注:本文中的org.apache.flink.streaming.api.watermark.Watermark.getTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。