[ 
https://issues.apache.org/jira/browse/FLINK-8581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365527#comment-16365527
 ] 

ASF GitHub Bot commented on FLINK-8581:
---------------------------------------

Github user pnowojski commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5423#discussion_r168475520
  
    --- Diff: flink-core/src/main/java/org/apache/flink/util/FutureUtil.java ---
    @@ -45,4 +52,36 @@ private FutureUtil() {
     
                return future.get();
        }
    +
    +   public static void waitForAll(long timeoutMillis, Future<?>...futures) 
throws Exception {
    +           waitForAll(timeoutMillis, Arrays.asList(futures));
    +   }
    +
    +   public static void waitForAll(long timeoutMillis, Collection<Future<?>> 
futures) throws Exception {
    +           long startMillis = System.currentTimeMillis();
    +           Set<Future<?>> futuresSet = new HashSet<>();
    --- End diff --
    
    Generally speaking you are right, but I think you missed removing finished 
futures from the `futuresSet`. Without this coping, removal could cause `wtf` 
moment for a user (`waitForAll` method removing something from the passed 
collection) and without removing, this code would be slow for larger number of 
futures.


> Improve performance for low latency network
> -------------------------------------------
>
>                 Key: FLINK-8581
>                 URL: https://issues.apache.org/jira/browse/FLINK-8581
>             Project: Flink
>          Issue Type: Improvement
>          Components: Network
>    Affects Versions: 1.5.0
>            Reporter: Piotr Nowojski
>            Assignee: Piotr Nowojski
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to