buffer.append("Missing configuration for HA local datasource. ");
if (getConnectionURL() == null)
buffer.append("No connection-url. ");
if (urlDelimiter == null)
buffer.append("No url-delimiter. ");
throw new JBossResourceException(buffer.toString());
}
// try to get a connection as many times as many urls we have in the list
for(int i = 0; i < urlSelector.getUrlList().size(); ++i)
{
String url = urlSelector.getUrl();
if(trace)
{
log.trace("Trying to create a connection to " + url);
}
try
{
Driver d = getDriver(url);
Connection con = d.connect(url, copy);
if(con == null)
{
log.warn("Wrong driver class for this connection URL: " + url);
urlSelector.failedUrl(url);
}
else
{
return new LocalManagedConnection(this, con, props, transactionIsolation, preparedStatementCacheSize);
}
}
catch(Exception e)
{
log.warn("Failed to create connection for " + url + ": " + e.getMessage());
urlSelector.failedUrl(url);
}
}
// we have supposedly tried all the urls
throw new JBossResourceException(
"Could not create connection using any of the URLs: " + urlSelector.getUrlList()
);
}