tillrohrmann commented on a change in pull request #8670: [hotfix][utils] 
Replace implemented FutureUtils#toJava with lib method
URL: https://github.com/apache/flink/pull/8670#discussion_r292416759
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java
 ##########
 @@ -807,20 +805,8 @@ public static Time toTime(FiniteDuration finiteDuration) {
         * @return Java 8 CompletableFuture
         */
        public static <T, U extends T> CompletableFuture<T> toJava(Future<U> 
scalaFuture) {
-               final CompletableFuture<T> result = new CompletableFuture<>();
-
-               scalaFuture.onComplete(new OnComplete<U>() {
-                       @Override
-                       public void onComplete(Throwable failure, U success) {
-                               if (failure != null) {
-                                       result.completeExceptionally(failure);
-                               } else {
-                                       result.complete(success);
-                               }
-                       }
-               }, Executors.directExecutionContext());
-
-               return result;
+               //noinspection unchecked
+               return scala.compat.java8.FutureConverters.toJava((Future<T>) 
scalaFuture).toCompletableFuture();
 
 Review comment:
   Where does this dependency come from? I fear that this is only a transitive 
dependency on which we should not directly depend.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to