commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bhaskar" <bhas...@yahoo-inc.com>
Subject Enhancement/suggession - GenericObjectPool.evict - log a warning if _numActive goes below _minIdle
Date Mon, 15 Oct 2007 07:11:50 GMT
Hi,
Recently we had a hardware issue due to which numActive use to drop
drastically (in netstat I found that number of connections established to
oracle db was keep on reducing). 
 
Enhancement/Suggession is to log a warning or recreate a new connection and
put into pool when _numActive  < _minIdle or _numActive < _maxIdle (please
refer to the suggested  code change)
 
I am new to this community so, i might be wrong in the code which i am
refering to.
 
Please let me know if it make sence to submit the patch on this.
 
thanks in advance,
Bhaskar
Suggested code change: 

public class GenericObjectPool extends BaseObjectPool implements ObjectPool
{

   .............

   ..............

    public synchronized void evict() throws Exception {

           .........

           .........

          if(removeObject) {

                     try {

                            iter.remove();

                            int prevNumActive = _numActive;

                           _factory.destroyObject(pair.value);

                           //suggession start

                            if( (prevNumActive < _maxIdle) || (_numActive <
_numIdle) )  {

                                       //log a warning telling that too many
connections are getting invalidated during eviction time.

                                               or

                                       //create a new connection and put it
into pool back.

                           }

                           //suggession end                 

                            } catch(Exception e) {

                                       // ignored

                            } 

}

PS: 

Enviornment: RHEL 4 with JDK 1.4

Configs: 

maxActive = 50

maxIdle = 30

factory=org.apache.commons.dbcp.BasicDataSourceFactory

maxWait=10000

timeBetweenEvictionRunsMillis=900000

numTestsPerEvictionRun=50

minEvictableIdleTimeMillis=1800000

testWhileIdle=true

I noticed that in netstat, number of connections with oracle db got reduced
from 12 to 8 at some point of time. 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message