Quote from tradelink:
david, yes.
an even better method is not to poll at all, but to send a message from first thread (populating queue) to the second thread, that one or more ticks have arrived.
this way you do not waste polling cycles. that is method we used here:
http://code.google.com/p/tradelink/source/browse/trunk/TradeLinkCommon/AsyncResponse.cs
this is a slightly simplistic example still, because it only uses one thread for tick processing... if you had many cores and were doing some very itnensive calculations you might want to use multiple threads... but this is VERY rare and most people don't need threads, especially IB traders because of IB's tick throttling. otherwise above method works for 80-90% of the situations even requiring high latency computations.
Maybe, but the use of a queue is very simple and more than adequate for handling the data rates from TWS. I do it this way, and any overhead is immeasurably small. I can monitor dozens of instruments and update hundreds of time series and you are still talking tiny CPU utilisation. It is the upstream code that may load the CPU depending on what you are doing.
The stuff in java.util.concurrent is pretty good.
No need for thread pools at all.