You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Hes Siemelink <he...@izecom.com> on 2004/09/27 15:53:02 UTC

Thread Pool

Hello

I want the thread-pool to wait for a little while when it is empty for threads to become available. In the default configuration it throws an exception in that case.

I tried adding the 'block-size' property to the 'thread-manager' part of config.xml, as Noel appeared to have suggested.

However, I don't see any evidence that that this parameter has any influence. Am I inserting it in the right spot? (see below)
I tried to locate the source code of the thing that actually does the thinging, but I got hopelessly lost.

Any ideas whether this is possible at all with the current state? (James 2.2 with its particular mix of excalibur and avalon components). Or am I just missing something?

Please let me know

Thanks

	Hes.

> -----Original Message-----
> From: Noel J. Bergman [mailto:noel@devtech.com] 
> Sent: donderdag 29 juli 2004 18:44
> To: James Developers List
> Subject: RE: Migration ... change for Thread Pool
>
> > I would like to be able to configure my thread pool so it
> > blocks (with a time-out) until a new thread is available,
> > so more mail will be accepted when the load is high.
>
> Not everyone wants the same thing, which is why you can replace the  
> thread manager.  However, take a look at the ResourceLimitingThread 
> classes in  http://svn.apache.org/repos/asf/avalon/cvs-migration-
snapshot/avalon-components/cornerstone/threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads/.  The configuration options should be flexible enough to 
> support both.

Whoa – that *is* hidden! You know, even for a trained user that is quite buried!
Does this mean I can add the following line to my config file?

   <thread-manager>
      <thread-group>
         <name>default</name>
         <priority>5</priority>
         <is-daemon>false</is-daemon>
         <max-threads>20</max-threads>
         <min-threads>20</min-threads>
         <min-spare-threads>10</min-spare-threads>

<!--  Tell thread manager to wait for 5 seconds for a thread to become available -->         <block-timeout>5000<block-timeout> 

      </thread-group>
   </thread-manager>