@Override protected Connection createConnection() throws SQLException { assertNotDisposed(); // check for a pooled connection PooledConnection pooledConnection = pool.pollLast(); if (pooledConnection != null) { return prepareConnection(pooledConnection); } // otherwise create a new one return super.createConnection(); }
@Override protected void connectionReturned(PooledConnection pooledConnection, long checkoutTime) { // if this pool has been disposed, or if we have too many connections already if (disposed.get() || getConnectionsActive() + pool.size() > getMaxConnections()) { // close this connection super.connectionReturned(pooledConnection, checkoutTime); } else { // otherwise add it to the pool pool.addLast(pooledConnection); } }
@Override protected void connectionReturned(PooledConnection pooledConnection, long checkoutTime) { // if this pool has been disposed, or if we have too many connections already if (disposed.get() || getConnectionsActive() + pool.size() > getMaxConnections()) { // close this connection super.connectionReturned(pooledConnection, checkoutTime); } else { // otherwise add it to the pool pool.addLast(pooledConnection); } }
@Override protected Connection createConnection() throws SQLException { assertNotDisposed(); // check for a pooled connection PooledConnection pooledConnection = pool.pollLast(); if (pooledConnection != null) { return prepareConnection(pooledConnection); } // otherwise create a new one return super.createConnection(); }