if (poolName.equals("read")) {
pool = serverSession.getReadConnectionPool();
// By default there is no connection pool, so if the default, create a new one.
if ((pool == null) || (pool == serverSession.getDefaultConnectionPool())) {
if (this.session.getDatasourceLogin().shouldUseExternalConnectionPooling()) {
pool = new ExternalConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession);
} else {
pool = new ConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession);
}
serverSession.setReadConnectionPool(pool);
}
} else if (poolName.equals("sequence")) {
pool = getDatabaseSession().getSequencingControl().getConnectionPool();
if (pool == null) {
if (this.session.getDatasourceLogin().shouldUseExternalConnectionPooling()) {
pool = new ExternalConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession);
} else {
pool = new ConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession);
}
getDatabaseSession().getSequencingControl().setConnectionPool(pool);
}
} else {
pool = serverSession.getConnectionPool(poolName);
if (pool == null) {
if (this.session.getDatasourceLogin().shouldUseExternalConnectionPooling()) {
pool = new ExternalConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession);
} else {
pool = new ConnectionPool(poolName, serverSession.getDatasourceLogin(), serverSession);
}
serverSession.addConnectionPool(pool);
}