views:

44

answers:

1

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. 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

+1  A: 

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.

John V.