答案 0 :(得分:1)
JDK 1.8引入了CompletableFuture。它提供了一个流畅的api来组合线程执行。 (http://www.deadcoderising.com/java8-writing-asynchronous-code-with-completablefuture/)
在您的示例中,它可以这样使用:
CompletableFuture futurA = CompletableFuture.runAsync(A);
CompletableFuture futurB = futurA.thenRun(B);
CompletableFuture futurC = futurA.thenRun(C);
CompletableFuture futurD = futurA.thenRun(D);
CompletableFuture.allOf(futureB, futureC, futureD).thenRun(E);