| Modifier and Type | Field and Description | 
|---|---|
static int | 
MAX_TRIES
Maximum number of times we retry a call if the server says it's overloaded. 
 | 
| Constructor and Description | 
|---|
JDBCUtils()  | 
| Modifier and Type | Method and Description | 
|---|---|
static <V> V | 
callWithRetry(Callable<V> callable)
Tries to do a JDBC call even when the server is overloaded. 
 | 
static Connection | 
getConnection(DataSource dataSource)
Tries to acquire a  
Connection through a DataSource even when the server is overloaded. | 
static Connection | 
getConnection(String url,
             String user,
             String password)
Tries to acquire a  
Connection through the DriverManager even when the server is overloaded. | 
static XAConnection | 
getXAConnection(XADataSource xaDataSource)
Tries to acquire a  
XAConnection through a XADataSource even when the server is overloaded. | 
public static final int MAX_TRIES
public JDBCUtils()
public static <V> V callWithRetry(Callable<V> callable) throws SQLException
Oracle has problems opening and closing many connections in a short time span (ORA-12516, ORA-12519). It seems to have something to do with how closed sessions are not immediately accounted for by Oracle's PMON (process monitor). When we get these errors, we retry a few times with exponential backoff.
callable - the callableSQLExceptionpublic static Connection getConnection(String url, String user, String password) throws SQLException
Connection through the DriverManager even when the server is overloaded.url - a database url of the form jdbc:subprotocol:subnameuser - the database user on whose behalf the connection is being madepassword - the user's passwordSQLExceptionpublic static Connection getConnection(DataSource dataSource) throws SQLException
Connection through a DataSource even when the server is overloaded.dataSource - the data sourceSQLExceptionpublic static XAConnection getXAConnection(XADataSource xaDataSource) throws SQLException
XAConnection through a XADataSource even when the server is overloaded.xaDataSource - the XA data sourceSQLExceptionCopyright © 2019 Nuxeo. All rights reserved.