[英]FJTask vs Future+Callables+ExecutorService
Objective: to make something like unpretentious map/reduce. 目标:制作简单的地图/缩小图。 There are many tasks they should be run in parallel, results added to the collection. 它们应并行执行许多任务,并将结果添加到集合中。 If the task lasts longer than a certain time (eg 3 seconds) - cancel it. 如果任务持续的时间超过特定时间(例如3秒),请取消任务。 Which way is faster and more convenient? 哪种方法更快更方便? Share your experiences in building a "correct" multi-threading. 分享您构建“正确的”多线程的经验。 thx in advance. 提前。
FJTask https://docs.google.com/viewer?url=http://gee.cs.oswego.edu/dl/papers/fj.pdf FJTask https://docs.google.com/viewer?url=http://gee.cs.oswego.edu/dl/papers/fj.pdf
Take a look at ParallelArrayWithMapping . 看一下ParallelArrayWithMapping 。 It is used in a ForkJoinPool (similar useage with FJTask). 它用于ForkJoinPool(与FJTask相似的用法)。 There is a method called reduce that may help you. 有一种称为reduce的方法可能会对您有所帮助。 Using a Fork Join Pool and the java 7 FJ Framework is very fast and offers nice exploitations of all available processors. 使用Fork Join Pool和Java 7 FJ Framework很快,并且可以很好地利用所有可用处理器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.