草庐IT

thenComposeAsync

全部标签

java - 如何使用 CompletableFuture.thenComposeAsync()?

给定:publicclassTest{publicstaticvoidmain(String[]args){intnThreads=1;Executore=Executors.newFixedThreadPool(nThreads);CompletableFuture.runAsync(()->{System.out.println("Task1.Thread:"+Thread.currentThread().getId());},e).thenComposeAsync((Voidunused)->{returnCompletableFuture.runAsync(()->{Syste