commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: Commons Pool/DBCP minIdle Implementation
Date Thu, 21 Aug 2003 15:10:51 GMT
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
>
>
>
>
>  
>




Mime
View raw message