Category Archives: apache-commons-pool

How to close the SSH Maverick Connection Object which uses Apache Commons Pool

I am using SSH Maverich Library for making SFTP Call and i encapsulated maverick objects and pooled connections objects using apache commons pool.

I implemented commons pool Factory method to create object.

How do I close the transport layer connection while idle object is eligible for eviction?

P.S.destroyObject in Factory is not working. Apache commons pool version: 1.6

DBCP connection hung

I am seeing following in the thread dump from load environment. I can see lot of connection available on the database side but still the queries are hung because of below wait. Any Idea if this is an issue with dpcp?

Jar Version : commons-dbcp-1.4.jar, commons-pool-1.5.3.jar and Jboss 7.1 server

<bean id="datasource1" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="org.postgresql.Driver"/>
    <property name="url" value=""/>
    <property name="username" value="" />
    <property name="password" value="" />
    <property name="poolPreparedStatements" value="false" />
    <property name="removeAbandoned" value="true" />
    <property name="logAbandoned" value="true" />
    <property name="validationQuery" value="SELECT 1" />
    <property name="timeBetweenEvictionRunsMillis" value="300000" />
    <property name="maxWait" value="30000" />
    <property name="maxActive" value="75"/>
    <property name="maxIdle" value="7"/>        

"http--" daemon prio=10 tid=0x00007f257049c800 nid=0x2cd3 in Object.wait() [0x00007f2487ebe000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject( - locked <0x000000055a810f00> (a org.apache.commons.pool.impl.GenericObjectPool$Latch) at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject( at org.apache.commons.dbcp.PoolingDataSource.getConnection( at org.apache.commons.dbcp.BasicDataSource.getConnection( at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection( at org.springframework.jdbc.datasource.DataSourceUtils.getConnection( at org.springframework.jdbc.core.JdbcTemplate.execute( at org.springframework.jdbc.core.JdbcTemplate.query(