[concurrency-interest] CompletableFuture in Java 8
Sebastian.Millies at softwareag.com
Fri Dec 5 09:46:43 EST 2014
From: concurrency-interest-bounces at cs.oswego.edu [mailto:concurrency-interest-bounces at cs.oswego.edu] On Behalf Of Josh Humphries
Sent: Friday, December 05, 2014 5:30 AM
To: √iktor Ҡlang
Cc: thurstonn; concurrency-interest
Subject: Re: [concurrency-interest] CompletableFuture in Java 8
As far as inter-op with legacy APIs, a #toFuture() method would have been much better for a few reasons:
1. Future is an interface, so a *view* could be returned instead of having to create a new stateful object that must be kept in sync with the original.
2. Future provides inter-op but doesn't leak complete*/obtrude* methods (the heart of my objections)
3. It could have been trivially implemented as a default method that just returns a CompletableFuture that is set from a #whenComplete stage, just as you've described.
In this context it would have been nice if Future had been provided with a default definition for join(). The exception handling with get() is a pain.
Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany – Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), Eric Duffaut, Dr. Wolfram Jost, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Dr. Andreas Bereczky - http://www.softwareag.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest