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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
