ome.services.db
Class SelfCorrectingDataSource
java.lang.Object
org.springframework.jdbc.datasource.DelegatingDataSource
ome.services.db.SelfCorrectingDataSource
- All Implemented Interfaces:
- Wrapper, CommonDataSource, DataSource, org.springframework.beans.factory.InitializingBean
public class SelfCorrectingDataSource
- extends org.springframework.jdbc.datasource.DelegatingDataSource
DataSource
delegate which wraps the
Methods inherited from class org.springframework.jdbc.datasource.DelegatingDataSource |
afterPropertiesSet, getLoginTimeout, getLogWriter, getTargetDataSource, isWrapperFor, setLoginTimeout, setLogWriter, setTargetDataSource, unwrap |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SelfCorrectingDataSource
public SelfCorrectingDataSource(DataSource delegate,
long timeoutInMilliseconds)
SelfCorrectingDataSource
public SelfCorrectingDataSource(DataSource delegate,
long timeoutInMilliseconds,
int maxRetries,
long maxBackOff)
getConnection
public Connection getConnection()
throws SQLException
- Specified by:
getConnection
in interface DataSource
- Overrides:
getConnection
in class org.springframework.jdbc.datasource.DelegatingDataSource
- Throws:
SQLException
getConnection
public Connection getConnection(String username,
String password)
throws SQLException
- Specified by:
getConnection
in interface DataSource
- Overrides:
getConnection
in class org.springframework.jdbc.datasource.DelegatingDataSource
- Throws:
SQLException
callWithRetries
protected Connection callWithRetries(String username,
String password,
boolean useArgs)
throws SQLException
- Throws:
SQLException
call
protected Connection call(String username,
String password,
boolean useArgs)
throws SQLException
- Throws:
SQLException
markAndSweep
protected long markAndSweep()
- First removes all entries in
errorTimes
that are older than some
given time and then uses the remaining number of errors to determine the
backoff : (#^1/2)*1000 milliseconds.
calculateBackOff
protected long calculateBackOff(int numberOfErrors)
OmeroJava Api
Version: 4.3.4-dbcbce5a-b4
Copyright © 2009 The University of Dundee. All Rights Reserved.