[concurrency-interest] CompletionStage.handle() with function returning CompletionStage

Petter Måhlén pettermahlen at gmail.com
Fri Feb 12 03:36:57 EST 2016


Hi,

One thing that I and my colleagues have felt is missing in CompletionStage
is a version of handle() (and exceptionally()) taking a function that
returns a CompletionStage<U> (or T) instead of a plain U. This is
particularly useful when doing things like fallbacks or retries for remote
service calls.

We've implemented those methods ourselves, calling them 'handleCompose' and
'exceptionallyCompose':
https://github.com/spotify/futures-extra/blob/master/src/main/java/com/spotify/futures/CompletableFuturesExtra.java#L110,
but of course using a static method like that reads less well than the
normal fluent API.

What is the rationale for not including those versions?

/ Petter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20160212/ab62ef6e/attachment.html>


More information about the Concurrency-interest mailing list