I am posed with the following problem: I need to split work across multiple threads for perfomance reasons, but I am not sure what approach to take.
Firstly, the tas
Slightly different approach is:
create a LinkedBlockingQueue
pass it to each task. Tasks can be Threads, or Runnables upon j.u.c.Executor.
each task adds its result to the queue
the main thread reads results using queue.take() in a loop
This way results are handled as soon as they are computed.