Executors.newCachedThreadPool sounds like its adequate for our needs. Can I confirm this is used/available in 0.2.0?
On Wed, Aug 18, 2010 at 1:00 PM, Alex Boisvert <[email protected]> wrote: > On Wed, Aug 18, 2010 at 1:52 AM, Phillip B Oldham > <[email protected]>wrote: > >> It seems, looking at some debugging output on my server, that the >> TThreadPool class in Java only creates 4 threads by default. How can I >> increase that limit? >> > > By default you get a CachedThreadPool returned by > Executors.newCachedThreadPool(). This thread pool that creates new threads > as needed, but will reuse previously constructed threads when they are > available. > > If you want to get a ThreadPool with fixed mininum and maximum number of > threads, you can use one of the TThreadPoolServer constructors that takes an > Options instance: > > public TThreadPoolServer(TProcessor processor, > TServerTransport serverTransport, > TTransportFactory inputTransportFactory, > TTransportFactory outputTransportFactory, > TProtocolFactory inputProtocolFactory, > TProtocolFactory outputProtocolFactory, > Options options) { > ... > } > > The Options class is defined as a static inner class of TThreadPoolServer: > > // Customizable server options > public static class Options { > public int minWorkerThreads = 5; > public int maxWorkerThreads = Integer.MAX_VALUE; > public int stopTimeoutVal = 60; > public TimeUnit stopTimeoutUnit = TimeUnit.SECONDS; > } > > Hope this helps, > alex > -- Phillip B Oldham [email protected] +44 (0) 7525 01 09 01
