Fwd: CompletableFuture eventual race condition

Francois Green francois.green at gmail.com
Mon Jul 11 19:58:27 UTC 2016


---------- Forwarded message ----------
From: Francois Green <francois.green at gmail.com>
Date: Mon, Jul 11, 2016 at 3:22 PM
Subject: Re: CompletableFuture eventual race condition
To: Martin Buchholz <martinrb at google.com>


I'm sorry for not posting the complete example.  The claim was, given
enough trials, this program will eventually fail to print due to a race
condition.

import java.util.concurrent.*;
public class HelloWorld {

    public static void main(String[] args) {
        CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java")
                         .thenApply(s -> s.replaceAll("j","l"))
                         .thenAccept(System.out::println);
    }
}

I doubt this claim, but I'm in no position to counter it.  Thanks for help
you can provide.


More information about the core-libs-dev mailing list