public class SelfCorrectingDataSource extends org.springframework.jdbc.datasource.DelegatingDataSource implements org.springframework.context.ApplicationListener<UserSignalMessage>
DataSource
delegate which wraps theConstructor and Description |
---|
SelfCorrectingDataSource(DataSource delegate,
long timeoutInMilliseconds) |
SelfCorrectingDataSource(DataSource delegate,
long timeoutInMilliseconds,
int maxRetries,
long maxBackOff) |
Modifier and Type | Method and Description |
---|---|
protected long |
calculateBackOff(int numberOfErrors) |
protected Connection |
call(String username,
String password,
boolean useArgs) |
protected Connection |
callWithRetries(String username,
String password,
boolean useArgs) |
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
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. |
void |
onApplicationEvent(UserSignalMessage usm)
Handles the USR1 posix signal by calling close on the underlying
data source via reflection. |
afterPropertiesSet, getLoginTimeout, getLogWriter, getTargetDataSource, isWrapperFor, setLoginTimeout, setLogWriter, setTargetDataSource, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParentLogger
public SelfCorrectingDataSource(DataSource delegate, long timeoutInMilliseconds)
public SelfCorrectingDataSource(DataSource delegate, long timeoutInMilliseconds, int maxRetries, long maxBackOff)
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
getConnection
in class org.springframework.jdbc.datasource.DelegatingDataSource
SQLException
public Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
getConnection
in class org.springframework.jdbc.datasource.DelegatingDataSource
SQLException
public void onApplicationEvent(UserSignalMessage usm)
data source
via reflection. The
assumption is that the next call to any methods will re-initialize
the data source. This is the case with
bitronix.tm.resource.jdbc.PoolingDataSourceonApplicationEvent
in interface org.springframework.context.ApplicationListener<UserSignalMessage>
protected Connection callWithRetries(String username, String password, boolean useArgs) throws SQLException
SQLException
protected Connection call(String username, String password, boolean useArgs) throws SQLException
SQLException
protected long markAndSweep()
errorTimes
that are older than some
given time and then uses the remaining number of errors to determine the
backoff : (#^1/2)*1000 milliseconds.protected long calculateBackOff(int numberOfErrors)
Version: 5.3.5-ice35-b73
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.