尝试滚动我自己的数据库连接池。
public Connection getConnection() throws SQLException{
List<Connection> idleConnections;
List<Connection> loanedConnections;
// try to reclaim any previously loaned out connections
// return a connection from my available pool
// if there's none enter code here`available, create a new one, add it to my pool, then load it out
}
我知道存在这样的事情,比如dbcp(https://commons.apache.org/proper/commons-dbcp/)。只是想知道是否有办法从这样的经理那里“借出对象”?