简体   繁体   中英

Connection Pool running out of connection. Using DBCP2 BasicDataSource in Jetty embedded server

Below are the details for configuring connection pool in my application. I am using Oracle 12C.

 initialSize=20    
 maxTotal=100
 minIdle=20
 maxWaitMillis=45000
 minEvictableIdleTimeMillis=3600000
 validationQueryTimeout=2
 removeAbandonedTimeout=10
 removeAbandonedTimeout=60
 removeAbandonedOnBorrow=true
 accessToUnderlyingConnectionAllowed=true
 testOnBorrow=true
 testWhileIdle=true
 logAbandoned=true
 defaultQueryTimeout=120

The number of active connections is progressive in nature and when it reached 100, it throws an error. For release connection I am using DataSourceUtils.releaseConnection(connection, datasource). I am also using DelegatingConnection in some places. In which cases the connections are not returned to the pool. I have run sonarqube but it doesnot show any potential connection leakages. Please suggest me if I need to change anything while configuring connection pool

I have fixed the solution. The point to be noted is we should never close delegating connection, instead we should close the wrapper connection. It has fixed the problem which I was facing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM