net.sourceforge.hivetranse.transaction.jdbc
Class ConnectionsRepositoryImpl
java.lang.Object
net.sourceforge.hivetranse.transaction.jdbc.ConnectionsRepositoryImpl
- All Implemented Interfaces:
- ConnectionsRepository
public class ConnectionsRepositoryImpl
- extends java.lang.Object
- implements ConnectionsRepository
Actual implementation class for ConnectionsRepository.
Enlisted connections are stored in a Map.
- Author:
- Jean-Francois Poilpret
|
Method Summary |
protected java.sql.SQLException |
closeConnection(java.lang.String id,
java.sql.Connection cnx)
|
void |
endAllConnections(boolean close,
boolean commit)
Terminate all connections enlisted in the current transaction. |
java.sql.Connection |
getConnection(java.lang.String id,
javax.sql.DataSource ds)
Get a Connection by its id for the current
transaction (in the current thread). |
protected java.sql.SQLException |
terminateConnection(java.lang.String id,
java.sql.Connection cnx,
boolean commit)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConnectionsRepositoryImpl
public ConnectionsRepositoryImpl()
getConnection
public java.sql.Connection getConnection(java.lang.String id,
javax.sql.DataSource ds)
throws java.sql.SQLException
- Description copied from interface:
ConnectionsRepository
- Get a
Connection by its id for the current
transaction (in the current thread).
If this connection does not exist yet then it is created by the
underlying DataSource and it is "enlisted" into the current
transaction.
- Specified by:
getConnection in interface ConnectionsRepository
- Parameters:
id - unique identifier of the Connectionds - DataSource to be used to create new Connection if needed
- Returns:
- the connection for this
id and the current
transaction
- Throws:
java.sql.SQLException
endAllConnections
public void endAllConnections(boolean close,
boolean commit)
throws java.sql.SQLException
- Description copied from interface:
ConnectionsRepository
- Terminate all connections enlisted in the current transaction.
Used only by
JdbcTransactionService.
- Specified by:
endAllConnections in interface ConnectionsRepository
- Parameters:
close - true if connections should be closed immediately
or notcommit - true if all connections should be committed
before closing, false if they should be rolled back
- Throws:
java.sql.SQLException
terminateConnection
protected java.sql.SQLException terminateConnection(java.lang.String id,
java.sql.Connection cnx,
boolean commit)
closeConnection
protected java.sql.SQLException closeConnection(java.lang.String id,
java.sql.Connection cnx)