|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.jdbc.TransactionResourceImpl
An instance of a TransactionResourceImpl is a bundle of things that connects a connection to the database - it is the transaction "context" in a generic sense. It is also the object of synchronization used by the connection object to make sure only one thread is accessing the underlying transaction and context.
TransactionResourceImpl not only serves as a transaction "context", it also takes care of:
The only connection that have access to the TransactionResource is the root connection, all other nested connections (called proxyConnection) accesses the TransactionResource via the root connection. The root connection may be a plain EmbedConnection, or a DetachableConnection (in case of a XATransaction). A nested connection must be a ProxyConnection. A proxyConnection is not detachable and can itself be a XA connection - although an XATransaction may start nested local (proxy) connections.
this is an example of how all the objects in this package relate to each other. In this example, the connection is nested 3 deep. DetachableConnection.
lcc cm database jdbcDriver ^ ^ ^ ^ | | | | |======================| | TransactionResource | |======================| ^ | | | | | |---------------rootConnection----------| | | | | | | |- rootConnection-| | | | | | | | V V | | |========================| |=================| |=================| | EmbedConnection | | EmbedConnection | | EmbedConnection | | |<-----| |<-----| | | (DetachableConnection) | | ProxyConnection | | ProxyConnection | |========================| |=================| |=================| ^ | ^ ^ ^ | | | | | ---rootConnection-- | | | | | | | | | |======================| |======================| |======================| | ConnectionChild | | ConnectionChild | | ConnectionChild | | | | | | | | (EmbedStatement) | | (EmbedResultSet) | | (...) | |======================| |======================| |======================|A plain local connection must be attached (doubly linked with) to a TransactionResource at all times. A detachable connection can be without a TransactionResource, and a TransactionResource for an XATransaction (called XATransactionResource) can be without a connection.
Field Summary | |
protected ContextManager |
cm
|
protected ContextService |
csf
|
protected Database |
database
|
private java.lang.String |
dbname
|
private java.lang.String |
drdaID
|
private Driver169 |
driver
|
protected LanguageConnectionContext |
lcc
|
private java.lang.String |
url
|
protected java.lang.String |
username
|
Constructor Summary | |
(package private) |
TransactionResourceImpl(Driver169 driver,
java.lang.String url,
java.util.Properties info)
|
Method Summary | |
boolean |
cleanupOnError(java.lang.Throwable e)
|
(package private) void |
clearContextInError()
An error happens in the constructor, pop the context. |
protected void |
clearLcc()
Resolve: probably superfluous |
protected void |
commit()
|
(package private) ContextManager |
getContextManager()
|
(package private) ContextService |
getCsf()
|
(package private) Database |
getDatabase()
|
(package private) java.lang.String |
getDBName()
|
(package private) Driver169 |
getDriver()
|
(package private) LanguageConnectionContext |
getLcc()
|
(package private) java.lang.String |
getUrl()
|
(package private) java.lang.String |
getUserName()
|
protected java.sql.SQLException |
handleException(java.lang.Throwable thrownException,
boolean autoCommit,
boolean rollbackOnAutoCommit)
|
(package private) boolean |
isActive()
|
boolean |
isIdle()
|
protected void |
restoreContextStack()
|
protected void |
rollback()
|
(package private) void |
setDatabase(Database db)
|
protected void |
setupContextStack()
|
(package private) StandardException |
shutdownDatabaseException()
|
(package private) void |
startTransaction()
|
static java.sql.SQLException |
wrapInSQLException(java.sql.SQLException sqlException,
java.lang.Throwable thrownException)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ContextManager cm
protected ContextService csf
protected java.lang.String username
private java.lang.String dbname
private Driver169 driver
private java.lang.String url
private java.lang.String drdaID
protected Database database
protected LanguageConnectionContext lcc
Constructor Detail |
TransactionResourceImpl(Driver169 driver, java.lang.String url, java.util.Properties info) throws java.sql.SQLException
Method Detail |
void setDatabase(Database db)
void startTransaction() throws StandardException, java.sql.SQLException
StandardException
java.sql.SQLException
Driver169 getDriver()
ContextService getCsf()
ContextManager getContextManager()
LanguageConnectionContext getLcc()
java.lang.String getDBName()
java.lang.String getUrl()
Database getDatabase()
StandardException shutdownDatabaseException()
protected void commit() throws StandardException
StandardException
protected void rollback() throws StandardException
StandardException
void clearContextInError()
protected void clearLcc()
protected final void setupContextStack()
protected final void restoreContextStack()
protected final java.sql.SQLException handleException(java.lang.Throwable thrownException, boolean autoCommit, boolean rollbackOnAutoCommit) throws java.sql.SQLException
java.sql.SQLException
public static final java.sql.SQLException wrapInSQLException(java.sql.SQLException sqlException, java.lang.Throwable thrownException)
java.lang.String getUserName()
public boolean cleanupOnError(java.lang.Throwable e)
public boolean isIdle()
boolean isActive()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |