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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to