Package africa.absa.inception.test
Class DataSourceProxy
java.lang.Object
africa.absa.inception.test.DataSourceProxy
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource
The DataSourceProxy class provides a proxy that tracks the JDBC connections associated
with the current thread and managed by a javax.sql.DataSource implementation.
- Author:
- Marcus Portmann
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddActiveDatabaseConnection(Connection connection) Add the database connection to the tracked active database connections associated with the current thread.static Map<Connection,StackTraceElement[]> Returns the active database connections for all Data Sources associated with the tracker.getConnection(String username, String password) intbooleanisWrapperFor(Class<?> iface) voidsetLoginTimeout(int seconds) voidsetLogWriter(PrintWriter out) <T> T
-
Constructor Details
-
DataSourceProxy
Constructs a new DataSourceProxy.- Parameters:
dataSource- the data source
-
-
Method Details
-
addActiveDatabaseConnection
Add the database connection to the tracked active database connections associated with the current thread.- Parameters:
connection- the connection
-
getActiveDatabaseConnections
Returns the active database connections for all Data Sources associated with the tracker.- Returns:
- the active database connections for all Data Sources associated with the tracker
-
createConnectionBuilder
- Specified by:
createConnectionBuilderin interfaceDataSource- Throws:
SQLException
-
createShardingKeyBuilder
- Specified by:
createShardingKeyBuilderin interfaceCommonDataSource- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-