Class TxJoiningDataSource
java.lang.Object
cloud.piranha.extension.datasource.DataSourceWrapper
cloud.piranha.extension.datasource.TxJoiningDataSource
- All Implemented Interfaces:
Wrapper
,CommonDataSource
,DataSource
Data source wrapper that adds connections retrieved from it to any ongoing transaction.
- Author:
- Arjan Tijms
-
Constructor Summary
ConstructorDescriptionTxJoiningDataSource
(DataSource dataSource) Creates a wrapper with the given data source -
Method Summary
Modifier and TypeMethodDescriptiongetConnection
(String username, String password) Attempt to get a non-transactional connection from this data source.getNonTxConnection
(String username, String password) Attempt to get a non-transactional connection from this data source.Methods inherited from class cloud.piranha.extension.datasource.DataSourceWrapper
createConnectionBuilder, createShardingKeyBuilder, getLoginTimeout, getLogWriter, getParentLogger, getWrapped, isWrapperFor, setLoginTimeout, setLogWriter, unwrap
-
Constructor Details
-
TxJoiningDataSource
Creates a wrapper with the given data source- Parameters:
dataSource
- the data source being wrapped
-
-
Method Details
-
getConnection
- Specified by:
getConnection
in interfaceDataSource
- Overrides:
getConnection
in classDataSourceWrapper
- Throws:
SQLException
-
getConnection
- Specified by:
getConnection
in interfaceDataSource
- Overrides:
getConnection
in classDataSourceWrapper
- Throws:
SQLException
-
getNonTxConnection
Attempt to get a non-transactional connection from this data source.- Returns:
- a connection that is not explicitly added to any ongoing transaction.
- Throws:
SQLException
- when something goes wrong
-
getNonTxConnection
Attempt to get a non-transactional connection from this data source.- Parameters:
username
- name to login to the databasepassword
- password to use to login to the database- Returns:
- a connection that is not explicitly added to any ongoing transaction.
- Throws:
SQLException
- when something goes wrong
-