tillrohrmann commented on a change in pull request #14528: URL: https://github.com/apache/flink/pull/14528#discussion_r550443289
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactory.java ########## @@ -69,36 +68,34 @@ NettyPartitionRequestClient createPartitionRequestClient(ConnectionID connectionId) throws IOException, InterruptedException { while (true) { - AtomicBoolean isTheFirstOne = new AtomicBoolean(false); - CompletableFuture<NettyPartitionRequestClient> clientFuture = - clients.computeIfAbsent( - connectionId, - unused -> { - isTheFirstOne.set(true); - return new CompletableFuture<>(); - }); - if (isTheFirstOne.get()) { + final CompletableFuture<NettyPartitionRequestClient> newClientFuture = + new CompletableFuture<>(); + + final CompletableFuture<NettyPartitionRequestClient> clientFuture = + clients.putIfAbsent(connectionId, newClientFuture); + + final NettyPartitionRequestClient client; + + if (clientFuture == null) { try { - clientFuture.complete(connectWithRetries(connectionId)); - } catch (InterruptedException e) { - clientFuture.complete(null); // let others waiting know that they should retry + client = connectWithRetries(connectionId); + } catch (RemoteTransportException | InterruptedException e) { Review comment: My assumption was that uncaught exceptions will trigger a fatal failure. If this isn't the case, then we should indeed catch all exceptions here. ---------------------------------------------------------------- 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: us...@infra.apache.org