/** * Returns a free connection. * * @return Connection handle. * @throws SQLException */ public Connection getConnection() throws SQLException { return this.connectionStrategy.getConnection(); }
/** * Returns a free connection. * @return Connection handle. * @throws SQLException */ public Connection getConnection() throws SQLException { return this.connectionStrategy.getConnection(); }
@Override protected Connection getConnectionInternal() throws SQLException { // try to get the connection from thread local storage. SimpleEntry<ConnectionHandle, Boolean> result = this.tlConnections.get(); // we should always be successful. If not, it means we have more threads asking // us for a connection than we've got available. This is not supported so we flip // back our strategy. if (result == null){ this.pool.cachedPoolStrategy = false; this.pool.connectionStrategy = this.fallbackStrategy; stealExistingAllocations(); // get a connection as if under our fallback strategy now. return (ConnectionHandle) this.pool.connectionStrategy.getConnection(); } return result.getKey(); }