Github user uce commented on a diff in the pull request:
https://github.com/apache/flink/pull/2600#discussion_r82142626
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/impl/FlinkFuture.java
---
@@ -232,6 +244,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 new
FlinkFuture.ThrowableWrapperException(e.getCause());
+ }
+ }
+ }
+ }, createExecutionContext(executor));
--- End diff --
Does it make sense to create the 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 [email protected] or file a JIRA ticket
with INFRA.
---