TisonKun 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_r292466025
 
 

 ##########
 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:
   Thank Till for your review!
   
   It is a dependency comes from org.scala-lang.modules as 
`org.scala-lang.modules:scala-java8-compat_2.11:0.7.0`, shipped within 
scala-lang and also mentioned in our `NOTICE` file.
   
   Besides, this module is marked as "currently still experimental" and thus I 
might give up this hotfix. I had expected to reduce a custom implementation 
DirectExecutionContext and maintain it.

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