[英]Struggling with Java CompletionStage/CompletableFuture
Looking at a the docs and a couple of examples, im still a little confused.看着文档和几个例子,我还是有点困惑。 I think I get the bare basics of it, but Im confused on when one would use them.我想我了解了它的基本知识,但我对何时使用它们感到困惑。
I guess my main questions..我想我的主要问题..
CompletionStage
is an interface that (1) can be implemented by any number of classes and (2) does not specify detailed policies such as the thread allocation of asynchronous operations. CompletionStage
是一个接口,(1) 可以由任意数量的类实现,(2) 不指定异步操作的线程分配等详细策略。
CompletableFuture
is a class that implements CompletionStage
(and Future
) and does provide more detail about those policies. CompletableFuture
是一个class ,它实现了CompletionStage
(和Future
)并且确实提供了有关这些策略的更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.