最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - UCP pool does not borrow all the active connections - Stack Overflow

programmeradmin6浏览0评论

I am using oracle ons.jar ojdbc8.jar and ucp.jar version 19.24 Using poolDataSource.getConnection(); to get the connection. Then I log the statistics returned from poolDataSource.getStatistics()

Pool size max is 500 I have MyCustomPoolDataSource class which takes PoolDataSource instance. MyCustomPoolDataSource acts as a wrapper around the PoolDataSource instance.

@Override
public Connection getConnection() throws SQLException {
    //Log all poolDataSource.getStatistics()
    Connection connection = poolDataSource.getConnection();
    connection.setAutoCommit(true);
    //Log all poolDataSource.getStatistics()
    return connection;
}

Then MyCustomPoolDataSource is injected to DAOs. That instance is used to create jdbcTemplate.

@Autowired
public RestAct(DataSource myCustomPoolDataSource) {
    this.jdbcTemplate = new JdbcTemplate(myCustomPoolDataSource);
}

While I am sending a load, I can see the poolDataSource.getStatistics().getTotalConnectionsCount() value increases gradually untill 500. But the getBorrowedConnectionsCount value barely exceeds 3. Once TotalConnectionsCount reached 500 ucp starts to throw UniversalConnectionPoolException : All connectoins in the Universal Connection Pool are in use But the borrowed count is only 3(or 1 or 2)

Why it is not borrowing/utilizing all the active connections?

发布评论

评论列表(0)

  1. 暂无评论