commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Wareing" <ware...@rewc.com>
Subject RE: Commons Pool/DBCP minIdle Implementation
Date Thu, 21 Aug 2003 18:55:57 GMT
I knew there was something I forgot :).  Yup I totally agree with you
guys and.  I modified my working code and so far all seems well.  I'll
play around with the parameters a bit to see if I can break it.

Richard...



-----Original Message-----
From: Dirk Verbeeck [mailto:dirk.verbeeck@pandora.be] 
Sent: Thursday, August 21, 2003 9:11 AM
To: Jakarta Commons Developers List
Subject: Re: Commons Pool/DBCP minIdle Implementation

I agree, maxActive should be respected.
Even with the WHEN_EXHAUSTED_GROW option, the evictor thread should 
limit itself.

Something like:
        int objectDeficit = getMinIdle() - getNumIdle();
        if (getMaxActive() > 0) {
            int growLimit = Math.max(0, getMaxActive() - getNumActive() 
- getNumIdle());
            objectDeficit = Math.min(objectDeficit, growLimit);
        }
        for ( int j = 0; j < objectDeficit; j++ ) {
            addObject();
        }

I'll commit this in a couple of hours.
Dirk

Noel J. Bergman wrote:

>Richard,
>
>I only looked at your patches out of context, so perhaps I missed it,
but
>where is the code to ensure that:
>
>+        // Check to see if we are below our minimum number of objects
>+        // if so enough to bring us back to our minimum.
>+        int objectDeficit = getNumIdle() - _minIdle;
>+        if ( objectDeficit < 0 ) {
>+            for ( int j = 0; j < Math.abs(objectDeficit); j++ ) {
>+                addObject();
>+            } // for
>+        } // if
>
>doesn't cause the number of objects to exceed the maximum?  Unless
>_whenExhaustedAction is WHEN_EXHAUSTED_GROW, there is no point in
allowing
>numActive + numIdle to exceed maxActive, because bollowObject() won't
permit
>any objects to be borrowed more than maxActive.  The default behavior
is to
>block until there are fewer than maxActive objects outstanding.
>
>	--- Noel
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>
>  
>




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message