zentol commented on a change in pull request #7245: [FLINK-11069] [utils] 
Remove FutureUtil
URL: https://github.com/apache/flink/pull/7245#discussion_r248256295
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/LocalInputChannelTest.java
 ##########
 @@ -158,27 +160,31 @@ public void testConcurrentConsumeMultiplePartitions() 
throws Exception {
                // Test
                try {
                        // Submit producer tasks
-                       List<Future<?>> results = 
Lists.newArrayListWithCapacity(
+                       List<CompletableFuture<?>> results = 
Lists.newArrayListWithCapacity(
                                parallelism + 1);
 
                        for (int i = 0; i < parallelism; i++) {
-                               
results.add(executor.submit(partitionProducers[i]));
+                               results.add(CompletableFuture.supplyAsync(
+                                       
CheckedSupplier.unchecked(partitionProducers[i]::call), executor));
                        }
 
                        // Submit consumer
                        for (int i = 0; i < parallelism; i++) {
-                               results.add(executor.submit(
-                                       new TestLocalInputChannelConsumer(
-                                               i,
-                                               parallelism,
-                                               numberOfBuffersPerChannel,
-                                               
networkBuffers.createBufferPool(parallelism, parallelism),
-                                               partitionManager,
-                                               new TaskEventDispatcher(),
-                                               partitionIds)));
+                               results.add(CompletableFuture.supplyAsync(
+                                       CheckedSupplier.unchecked(
+                                               new 
TestLocalInputChannelConsumer(
 
 Review comment:
   Please introduce a dedicated variable for the consumer to make this code 
more readable, i.e.
   ```
   final TestLocalInputChannelConsumer consumer = ....
   results.add(CompletableFuture. .... (consumer::call)...);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to