FJTask vs Future+Callables+ExecutorService
Objective: to make someth开发者_如何学JAVAing 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. 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
Take a look at ParallelArrayWithMapping. It is used in a ForkJoinPool (similar useage with FJTask). There is a method called reduce that may help you. Using a Fork Join Pool and the java 7 FJ Framework is very fast and offers nice exploitations of all available processors.
精彩评论