commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trenton D. Adams" <tre...@athabascau.ca>
Subject Re: abandoned connection removal and logging not working
Date Thu, 24 Feb 2005 20:07:33 GMT
Andre Van Klaveren wrote:
> Oh  yeah!  They mention that formula on the DBCP configuration page
> (at the bottom).  I didn't think of looking for that.  Good catch.

Oops, my bad on that one.  I should have read the 
"<strong><u><b>*WHOLE*</b></u></strong>" thing. ;)

> 
> Virtually,
> Andre Van Klaveren
> 
> 
> On Thu, 24 Feb 2005 12:02:39 -0700, Trenton D. Adams
> <trenta@athabascau.ca> wrote:
> 
>>I looked in the AbandonedObjectPool code and found the following.
>>
>>        if (config != null
>>                 && config.getRemoveAbandoned()
>>                 && (getNumIdle() < 2)
>>                 && (getNumActive() > getMaxActive() - 3) ) {
>>             removeAbandoned();
>>
>>So, I never came close to the abandoned connections being removed
>>because my max active was set to 20 or something, and I had only a
>>couple of dangling connections.  I thought this would be done in a
>>background thread, but I guess not.
>>
>>Trenton D. Adams wrote:
>>
>>>I have the following code, and it doesn't clean up abandoned
>>>connections.  Anybody have an idea of what I am doing wrong?
>>>
>>>    AbandonedConfig abandonedConfig;
>>>    ObjectPool connectionPool;
>>>    ConnectionFactory connectionFactory;
>>>    PoolableConnectionFactory poolableConnectionFactory;
>>>    PoolingDriver driver;
>>>
>>>    // setup the abandoned configuration
>>>    abandonedConfig = new AbandonedConfig();
>>>    abandonedConfig.setLogAbandoned(true);
>>>    abandonedConfig.setRemoveAbandoned(true);
>>>    abandonedConfig.setRemoveAbandonedTimeout(60);
>>>
>>>    // setup the AbandonedObjectPool
>>>    connectionPool = new AbandonedObjectPool(null, abandonedConfig);
>>>    ((GenericObjectPool)connectionPool).setMaxActive(maxConn);
>>>    ((GenericObjectPool)connectionPool).setMaxIdle(maxFree);
>>>    ((GenericObjectPool)connectionPool).setTestWhileIdle(true);
>>>    ((GenericObjectPool)connectionPool).setWhenExhaustedAction(
>>>        GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
>>>    ((GenericObjectPool)connectionPool).setMaxWait(30);
>>>    ((GenericObjectPool)connectionPool).setTestOnBorrow(true);
>>>    ((GenericObjectPool)connectionPool).setTestOnReturn(true);
>>>
>>>((GenericObjectPool)connectionPool).setTimeBetweenEvictionRunsMillis(10000);
>>>
>>>    ((GenericObjectPool)connectionPool).setNumTestsPerEvictionRun(10);
>>>    ((GenericObjectPool)connectionPool).setMinEvictableIdleTimeMillis(10);
>>>
>>>    connectionFactory = new DriverManagerConnectionFactory(url, user,
>>>password);
>>>    poolableConnectionFactory = new PoolableConnectionFactory(
>>>        connectionFactory,connectionPool,null,
>>>        "SELECT 'ping' FROM dual",false,false,
>>>        Connection.TRANSACTION_SERIALIZABLE, null, abandonedConfig);
>>>    try
>>>    {
>>>      Class.forName("org.apache.commons.dbcp.PoolingDriver");
>>>      dbcpURL = "jdbc:apache:commons:dbcp:" + name;
>>>      driver = (PoolingDriver) DriverManager.getDriver(dbcpURL);
>>>      driver.registerPool(name, connectionPool);
>>>    }
>>>    catch (Exception exception)
>>>    {
>>>      RemoteBannerServer.log(exception, "error creating DBCP connection
>>>pool");
>>>    }
>>
>>--
>>Trenton D. Adams
>>Web Programmer Analyst
>>Navy Penguins at your service!
>>Athabasca University
>>(780) 675-6195
>>
>>__
>>    This communication is intended for the use of the recipient to whom it
>>    is addressed, and may contain confidential, personal, and or privileged
>>    information. Please contact us immediately if you are not the intended
>>    recipient of this communication, and do not copy, distribute, or take
>>    action relying on it. Any communications received in error, or
>>    subsequent reply, should be deleted or destroyed.
>>---
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


-- 
Trenton D. Adams
Web Programmer Analyst
Navy Penguins at your service!
Athabasca University
(780) 675-6195

---------------------------------------------------------------------
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