简体   繁体   English

ForkJoinPool中递归任务和递归操作之间的区别

[英]Difference between recursive task and recursive action in ForkJoinPool

We can submit two types of tasks to forkJoinPool . 我们可以向forkJoinPool提交两种类型的任务。 one is RecursiveAction and other is RecursiveTask . 一个是RecursiveAction ,另一个是RecursiveTask

What is the difference between both of them? 它们之间有什么区别?

From the first lines of their respective Javadocs: 从他们各自的Javadocs的第一行:

Although technically, RecursiveAction does return a value, it's just always null , because it's a ForkJoinTask<Void> , and that's the only possible value of Void . 虽然从技术上讲, RecursiveAction 确实返回一个值,但它总是为null ,因为它是一个ForkJoinTask<Void> ,这是Void唯一可能的值。

它们是相似的,除了RecursiveTask返回结果而RecursiveAction没有返回值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM