public class SelfCorrectingDataSource extends org.springframework.jdbc.datasource.DelegatingDataSource implements org.springframework.context.ApplicationListener<UserSignalMessage>
DataSource
delegate which wraps theConstructor and Description |
---|
SelfCorrectingDataSource(javax.sql.DataSource delegate,
long timeoutInMilliseconds) |
SelfCorrectingDataSource(javax.sql.DataSource delegate,
long timeoutInMilliseconds,
int maxRetries,
long maxBackOff) |
Modifier and Type | Method and Description |
---|---|
protected long |
calculateBackOff(int numberOfErrors) |
protected java.sql.Connection |
call(java.lang.String username,
java.lang.String password,
boolean useArgs) |
protected java.sql.Connection |
callWithRetries(java.lang.String username,
java.lang.String password,
boolean useArgs) |
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.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
public SelfCorrectingDataSource(javax.sql.DataSource delegate, long timeoutInMilliseconds)
public SelfCorrectingDataSource(javax.sql.DataSource delegate, long timeoutInMilliseconds, int maxRetries, long maxBackOff)
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
getConnection
in class org.springframework.jdbc.datasource.DelegatingDataSource
java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
getConnection
in class org.springframework.jdbc.datasource.DelegatingDataSource
java.sql.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 java.sql.Connection callWithRetries(java.lang.String username, java.lang.String password, boolean useArgs) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Connection call(java.lang.String username, java.lang.String password, boolean useArgs) throws java.sql.SQLException
java.sql.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.4.4-ice35-b82
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.