In this program there is a race between the program ending and the computation trying to print from the daemon thread in the forkjoin pool! 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); } } Try adding a join: import java.util.concurrent.*; public class JoinRace { public static void main(String[] args) { CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") .thenApply(s -> s.replaceAll("j","l")) .thenAccept(System.out::println).join(); } } On Mon, Jul 11, 2016 at 10:44 AM, Francois Green <francois.green@gmail.com> wrote:
I sorry for posting in list, but I need an authoritative answer. I was told by one of the developers of another JVM (Ceylon) language that
CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") .thenApply(s -> s.replaceAll("j","l")) .thenAccept(System.out::println);
would eventual fail to print if run enough times. Is this true?