RFR 8029164: Race condition in CompletableFuture.thenCompose with asynchronous task

Mike Duigou mike.duigou at oracle.com
Mon Dec 2 20:29:30 UTC 2013

Looks fine to me.


On Nov 27 2013, at 03:02 , Paul Sandoz <paul.sandoz at oracle.com> wrote:

> Hi,
> https://bugs.openjdk.java.net/browse/JDK-8029164
> http://cr.openjdk.java.net/~psandoz/tl/JDK-8029164-thenCompose-async/webrev/
> This fixes an issue with CompletableFuture.thenCompose.  
> If the composing future is already completed before the call to thenCompose (or completes during some part of the call to thenCompose) and the composing function returns a future that is not yet completed then there is race to set the result, usually won by thenCompose which incorrectly sets the result to null, due to an errant conditional statement.
> Doug has reviewed and committed the fix to the 166 repo and we have double checked there are no similar errors lurking in other areas of CompletableFuture code.
> Paul.

More information about the core-libs-dev mailing list