lindong28 commented on a change in pull request #15633:
URL: https://github.com/apache/flink/pull/15633#discussion_r615512096



##########
File path: 
flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/networking/NetworkFailureHandler.java
##########
@@ -73,8 +76,10 @@ public NetworkFailureHandler(
 
     /** Closes the specified channel after all queued write requests are 
flushed. */
     static void closeOnFlush(Channel channel) {
-        if (channel.isConnected()) {
+        if (channel.isConnected() && 
!channelsBeingClosed.containsKey(channel)) {
+            channelsBeingClosed.put(channel, channel);
             
channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
+            channelsBeingClosed.remove(channel);

Review comment:
       Thank you @dawidwys for catching this. Yep you are right. I have updated 
the PR according to the suggestions.
   
   For now I still keep the `channelsBeingClosed` above the 
`NetworkFailureHandler` constructor instead of moving it right above the 
`closeOnFlush()`.  This is to follow the current Flink code style where all 
`static final` variables are above the class constructor.
   
   Could you take another look?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to