Hi All,

        Hope all is well.

        After playing around with the Excalibur code in jswat I was able
        to validate what was going on inside the pooling code when a
        pool reaches it's maximum capacity.

        With the current code, pools shrink everytime they are full (ie.
        everytime they reach capacity, but not exceed it). I'm not sure
        if this was intended ? (please correct me if I'm wrong) but IMO I think
        this is different than expected by a developer.

        Attached is a patch to fix DefaultPool so that pools are reduced
        in size only when they exceed capacity, not when they reach it. Hope
        it's ok.

        I've also attached the test program I wrote to validate the fix
        just in case someone else would like to check it.

        Cheers,

        Marcus

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : [EMAIL PROTECTED]
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:

Attachment: test.tar.gz
Description: Binary data

Index: src/java/org/apache/avalon/excalibur/pool/DefaultPool.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/pool/DefaultPool.java,v
retrieving revision 1.6
diff -u -r1.6 DefaultPool.java
--- src/java/org/apache/avalon/excalibur/pool/DefaultPool.java  2001/11/19 
12:08:48     1.6
+++ src/java/org/apache/avalon/excalibur/pool/DefaultPool.java  2001/12/08 
16:24:35
@@ -183,7 +183,7 @@
             {
                 m_ready.add(obj);
 
-                if( (this.size() >= m_max) && (this instanceof Resizable) )
+                if( (this.size() > m_max) && (this instanceof Resizable) )
                 {
                     this.internalShrink( m_controller.shrink() );
                 }
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to