Java Future and infinite computation

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-26T10:07:40Z Indexed on 2010/03/26 10:13 UTC
Read the original article Hit count: 359

Filed under:
|

I'm trying to optimize an (infinite) computation algorithm.

I have an infinte Sum to calculate ( Summ_{n-> infinity} (....) ) My idea was to create several threads using the Future < > construct, then combine the intermediate results together. My problem hoewer is that I need a certain precision. So I need to constantly calculate the current result while other threads keep calculating.

My question is: Is there some sort of result queue where each finished thread can put its results in, while a main thread can receive those results and then either lets the computation continues or terminate the whole ExecutorService?

Any Help would really be appreciated! Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about future