简体   繁体   English

FJTask与Future + Callables + ExecutorService

[英]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.

相关问题 Java:带有Callables的ExecutorService:invokeAll()和future.get()-结果顺序正确吗? - Java: ExecutorService with Callables: invokeAll() and future.get() - results in correct order? Java:带有Callables的ExecutorService:Timeout:future.get()导致程序的直接中断 - Java: ExecutorService with Callables: Timeout: future.get() leads to direct break of program 调用executorService.invokeAll(callables)时如何按顺序获取Future列表? - How to get the Future list in order when calling the executorService.invokeAll(callables)? Executorservice调用所有超时与将来获取超时 - Executorservice InvokeAll Timeout vs Future get Timeout 遍历列表并将可调用对象提交给ExecutorService - Iterating over list and submitting Callables to an ExecutorService Java:ExecutorService和Callables,无法捕获异常 - Java: ExecutorService and Callables, unable to catch exception Java的ExecutorService.awaitTermination与Future.get( <TimeOut> ) - Java's ExecutorService.awaitTermination vs Future.get(<TimeOut>) JAVA:提交给ExecutorService的可调用对象与ExecutorService之外的线程之间的执行顺序 - JAVA: Execution Order between Callables submitted to ExecutorService and Threads Outside of the ExecutorService 在ExecutorService中捕获所有期货/可赎回债券的异常 - Catching Exceptions of all Futures/Callables in an ExecutorService 确定当前在ExecutorService中运行的Callables - Determining which Callables are currently running in ExecutorService
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM