I'm creating connection manager class that would return connections to the customers of the class. My goal is to always have 2 available connections in pool so I wouldn't loose time for creating connections. When I return the available connection, I need to make UCP create new available connection, so it would be always 2 connections available.
The problem is UCP doesn't have an option to control it. I've read the UCP documentation, but hadn't found any solution.
There is setMinPoolSize() method, but it controls available + borrowed connections, not only the available ones. And it doesn't create new connections in case you haven't reached the minimum pool size.
Also there is a harvestable connection functionality, but it harvests existing (borrowed) connections instead of creating new.
Is there any way to make UCP create new available connection when I borrow one from UCP.
Note: I'm using Oracle 188.8.131.52 and the latest ucp.jar (for Oracle 184.108.40.206)
My goal is to always have 2 available connections in pool so I wouldn't loose time for creating connections.
These days that isn't generally a problem that one needs to manage in detail for a standard data center set up.
High volume (really high volume) applications that benefit from this often will measure that sort of time at such low levels that it nothing more than noise compared to processing for the rest of system. Not to mention of course that if the database API usage itself seems likely to be a bottleneck then designing for that rather than attempting to optimize it afterwards is going to provides significantly better performance.