commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From comm...@nemesi.co.uk
Subject [GenericObjectPool] minIdle and maxIdle
Date Thu, 17 Aug 2006 10:28:35 GMT
Hi Everyone,

first post in this list... I just need a clarification regarding the minIdle
and maxIdle fields for the GenericObjectPool class. I am using this class,
together with PoolableObjectFactory, to implement a Connection Pool for a DB
for which I can not use the standard JNDI/DataSource pooling mechanism and I
simply need a clarification on the correct usage of the maxIdle and minIdle
class fields.

1) maxIdle will set the maximum number of idle objects (in my case db
connections) that can sit idle in the pool. This means that if I always want
to have at least 5 "live" connections ready to listen to requests then I will
set maxIdle = 5. Is this correct? If not, could you please explain why and
what I should do to implemente this mechanism?

2) minIdle... the doc says "The default minimum number of "sleeping" instances
in the pool before before the evictor thread (if active) spawns new objects".
I want the evictor thread to run everytime there are more than 5 (maxIdle?)
idle connections in my pool. To which value should I then set minIdle to? 1?
or 6 (5 + 1)? or something else?

My confusion is actually caused by the definition of the
DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS that is the "time an object may
sit idle in the pool before it is eligable for eviction by the idle object
evictor (if any), with the extra condition that at least "minIdle" amount of
object remain in the pool"... 

I would have expected this to say "...with the extra condition that at least
"MAXIDLE" amount of object remain in the pool...

Thanks in advance for any reply.

Kind Regards,
Francesco




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


Mime
View raw message