在下面的代码中,调用thenRunAsync会有什么不同吗?我应该打电话给那么跑吗?
CompletableFuture.runAsync(this::doWork , executorService)
.thenRunAsync(this::handleSuccess);
Run Code Online (Sandbox Code Playgroud)
根据评论进行阐述:如果我使用此代码,
CompletableFuture.runAsync(this::doWork , executorService)
.thenRun(this::handleSuccess);
Run Code Online (Sandbox Code Playgroud)
会有什么不同吗?
在这两种情况下,行为都是非阻塞的,并且无论如何,第二个任务在第一个任务完成之前不会运行,据我所知.