flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetzger <...@git.apache.org>
Subject [GitHub] flink pull request #2350: [FLINK-4329] Fix Streaming File Source Timestamps/...
Date Mon, 22 Aug 2016 10:06:30 GMT
Github user rmetzger commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2350#discussion_r75651032
  
    --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSource.java
---
    @@ -214,14 +216,26 @@ public AutomaticWatermarkContext(
     			this.watermarkInterval = watermarkInterval;
     			this.reuse = new StreamRecord<T>(null);
     
    +			// if it is a source, then we cast and cache it
    +			// here so that we do not have to do it in every collect(),
    +			// collectWithTimestamp() and emitWatermark()
    +
    +			if (!(owner instanceof AsyncExceptionChecker)) {
    +				throw new IllegalStateException("The ManualWatermarkContext can only be used " +
    +					"with sources that implement the AsyncExceptionThrower interface.");
    +			}
    +			this.source = (AsyncExceptionChecker) owner;
    +
     			long now = owner.getCurrentProcessingTime();
     			this.watermarkTimer = owner.registerTimer(now + watermarkInterval,
     				new WatermarkEmittingTask(owner, lockingObjectParam, outputParam));
     		}
     
     		@Override
     		public void collect(T element) {
    -			owner.checkAsyncException();
    +			if (source != null) {
    --- End diff --
    
    I don't think these null checks are needed, because the `IllegalStateException` is thrown
if `owner` is `null`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message