com.github.drinkjava2.jtransactions.tinytx
Class TinyTxConnectionManager
java.lang.Object
com.github.drinkjava2.jtransactions.tinytx.TinyTxConnectionManager
- All Implemented Interfaces:
- ConnectionManager
public class TinyTxConnectionManager
- extends Object
- implements ConnectionManager
DataSourceManager determine how to get or release connection from DataSource,
it can be different transaction strategies like JDBC/SpringManaged/JTA..
- Since:
- 1.0.0
- Author:
- Yong Zhu
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
threadLocalConnections
public static final ThreadLocal<Map<DataSource,Connection>> threadLocalConnections
TinyTxConnectionManager
public TinyTxConnectionManager()
instance
public static final TinyTxConnectionManager instance()
- Returns:
- A singleton instance of TinyTxConnectionManager
isInTransaction
public boolean isInTransaction(DataSource ds)
- Description copied from interface:
ConnectionManager
- Check if a connection already be get from given dataSource and be cached as
it started a Transaction
- Specified by:
isInTransaction in interface ConnectionManager
startTransaction
public void startTransaction(DataSource ds,
Connection conn)
endTransaction
public void endTransaction(DataSource ds)
getConnection
public Connection getConnection(DataSource ds)
throws SQLException
- Description copied from interface:
ConnectionManager
- A ConnectionManager implementation determine how to get connection from
DataSource or ThreadLocal or from Spring or JTA or some container...
- Specified by:
getConnection in interface ConnectionManager
- Throws:
SQLException
releaseConnection
public void releaseConnection(Connection conn,
DataSource ds)
throws SQLException
- Description copied from interface:
ConnectionManager
- A ConnectionManager implementation determine how to close connection or
return connection to ThreadLocal or return to Spring or JTA or some
container...
- Specified by:
releaseConnection in interface ConnectionManager
- Throws:
SQLException
Copyright © 2018. All rights reserved.