Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/2789
  
    I would actually like to not change how/when `handover.close()` is called. 
It is called more often that necessary (probably), but since it is an 
idempotent operation, it does not matter.
    
    The code is designed to lead to the quickest wakeup/termination possible in 
all cases:
      - cancellation
      - end of stream
      - error in the fetcher
      - error in the consumer
    
    Also note that errors/close do not overwrite each other, which makes it 
fine if the other is called afterwards in addition.
    
    Also, both the fetcher and the KafkaConsumerThread are written to 
encapsulate all necessary logic self contained. That means they do not rely on 
each other to call `handover.close()` in any situation - that makes the design 
more robust.


---
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