public class ConnectionProviderPriorityList extends Object implements ConnectionProvider
Constructor and Description |
---|
ConnectionProviderPriorityList() |
Modifier and Type | Method and Description |
---|---|
Connection |
getConnection(DataSource[] ds)
Obtain a connection from the datasources, starting on the first
datasource, and if unable to obtain a connection skips to the next one on the list, and try again until the list is exhausted.
|
void |
setFailOnError(boolean flag)
Flag if an error causes the operation to thrown an exception, or false to skip to next DataSource.
|
public void setFailOnError(boolean flag)
ConnectionProvider
setFailOnError
in interface ConnectionProvider
flag
- true if to fail on errorpublic Connection getConnection(DataSource[] ds) throws SQLException
getConnection
in interface ConnectionProvider
ds
- the array of datasources. An ordered list of datasourcesds
is null, or null if the DataSources has returned a null as connectionSQLException
- in case of error and failOnError is true or the error occurs while obtaining a connection with the last
DataSource on the listCopyright © 2017. All rights reserved.