views:

717

answers:

2

Hi all,

I am using Jetty 6 and was wondering when the QueuedThreadPool should be used over the ThreadPool? By default, Jetty 6 comes configured with the QueuedThreadPool.

My server has Java 6 installed so I was thinking that I should use the ThreadPool:

<New class="org.mortbay.thread.QueuedThreadPool">
      <Set name="minThreads">10</Set>
      <Set name="maxThreads">200</Set>
      <Set name="lowThreads">20</Set>
      <Set name="SpawnOrShrinkAt">2</Set>
     </New>

<New class="org.mortbay.thread.concurrent.ThreadPool">
      <Set name="corePoolSize">50</Set>
      <Set name="maximumPoolSize">50</Set>
     </New>

Thanks, Walter

+1  A: 

Were you able to get an answer? I am looking for the same thing. What are the pros/cons of using ThreadPool ?

Bill Bell
No, I didn't get a response as you can tell. My guess would be if you're using Java 5 and newer, then you would want to use the concurrent thread pool just reading the comments. However, as I opened up the source code, I really couldn't tell what the performance gain would be. It supposedly wraps the other class.I think you would see a larger performance gain if you use the QoSFilter. This helps prevent your server from blowing up by queuing requests and restricting how many are processed at a time. Also, the grizzly nio connector will further enhance performance when it's out.
You can manually add the grizzly connector from svn, but I would just wait a few weeks when 7.0 is GA and ships with grizzly out of beta.
A: 

I am using Glassfish now, it seems to be better written and supports the latest Java EE specs.