Github user uce commented on a diff in the pull request: https://github.com/apache/flink/pull/2600#discussion_r82142194 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/impl/FlinkFuture.java --- @@ -232,6 +242,40 @@ public R recover(Throwable failure) throws Throwable { return new FlinkFuture<>(recoveredFuture); } + @Override + public <U, R> Future<R> thenCombineAsync(final Future<U> other, final BiFunction<? super T, ? super U, ? extends R> biFunction, final Executor executor) { + final scala.concurrent.Future<U> thatScalaFuture; + + if (other instanceof FlinkFuture) { + thatScalaFuture = ((FlinkFuture<U>) other).scalaFuture; + } else { + thatScalaFuture = Futures.future(new Callable<U>() { + @Override + public U call() throws Exception { + try { + return other.get(); + } catch (ExecutionException e) { + // unwrap the execution exception if it's not a throwable + if (e.getCause() instanceof Exception) { + throw (Exception) e.getCause(); + } else { + throw e; + } + } + } + }, createExecutionContext(executor)); --- End diff -- Does it make sense to create the execution context wrapper only once?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---