You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering why FutureConverters.toJava creates a new CompletableFuture, rather than simply wrapping the Future with an implementation of CompletionStage that delegates to Future? Doing this would make conversion a little more efficient, and would mean conversions back and forth could be optimised so a conversion from a previously converted CompletionStage to Future would simply unwrap the Future.
The latter especially will be useful in Play, since we want to allow both Java and Scala code to intercept requests, and mixing these interceptors will potentially mean lots of conversions back and forth between the types. If it's just a simple wrapping/unwrapping, then we don't need to worry about the cost associated with it, otherwise we may end up with long chains of Futures and CompletionStages that add nothing to the actual value except overhead.
The text was updated successfully, but these errors were encountered:
Makes `toJava.toScala` and `toScala.toJava` a wrap-and-unwrap
operation, rather than a wrap-and-rewrap.
This won't be possible if we merge scala#46, which speaks in favour
of reverting the change that finalized `DefaultPromise` in Scala
2.12.x.
This patch does not attempt to "wrap the Future with an implementation
of CompletionStage that delegates to Future", as Jame's proposed in
issue scala#44, which seems tricky or at least tedious to implement.
I'm wondering why
FutureConverters.toJava
creates a newCompletableFuture
, rather than simply wrapping theFuture
with an implementation ofCompletionStage
that delegates toFuture
? Doing this would make conversion a little more efficient, and would mean conversions back and forth could be optimised so a conversion from a previously convertedCompletionStage
toFuture
would simply unwrap theFuture
.The latter especially will be useful in Play, since we want to allow both Java and Scala code to intercept requests, and mixing these interceptors will potentially mean lots of conversions back and forth between the types. If it's just a simple wrapping/unwrapping, then we don't need to worry about the cost associated with it, otherwise we may end up with long chains of Futures and CompletionStages that add nothing to the actual value except overhead.
The text was updated successfully, but these errors were encountered: