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--0.0.0.0-8080-741" 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(GenericObjectPool.java:1112) - locked <0x000000055a810f00> (a org.apache.commons.pool.impl.GenericObjectPool$Latch) at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:381) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:455)