How to cancel Java 8 completable future?

前端 未结 5 1822
面向向阳花
面向向阳花 2020-12-09 16:28

I am playing with Java 8 completable futures. I have the following code:

CountDownLatch waitLatch = new CountDownLatch(1);

CompletableFuture future         


        
5条回答
  •  离开以前
    2020-12-09 16:29

    You need an alternative implementation of CompletionStage to accomplish true thread interruption. I've just released a small library that serves exactly this purpose - https://github.com/vsilaev/tascalate-concurrent

提交回复
热议问题