Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5394
I think neither solve the problem.
Variant 2 looks identical to what we have in master.
Variant 1 only allows interrupts after the task was canceled.
According to what
Github user tillrohrmann commented on the issue:
https://github.com/apache/flink/pull/5394
What's the state @zentol? Would Stephan's proposal work?
---
Github user StephanEwen commented on the issue:
https://github.com/apache/flink/pull/5394
I have often handled it like one of the below variants. What do you think
about that pattern?
### Variant 1: Handle interruption if still running
```java
public void
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/5394
How about calling `Thread.currentThread().interrupt();` only after having
left the loop?
```
public void run(SourceContext ctx) throws Exception {
boolean setInterruptFlag = false;
Github user StephanEwen commented on the issue:
https://github.com/apache/flink/pull/5394
It may not be a problem in this test, but I wanted to raise that this
pattern is a bit dangerous.
If the thread ever gets interrupted while 'running' is still true, this
goes into a hot loop