Methods Summary |
---|
public void | afterCompletion(java.lang.Object status)INTERNAL:
The method performs the logic that should be executed after the transaction
has been completed. The status passed in indicates whether the transaction
was committed or rolled back. This status flag may be different for different
implementations.
This method executes without a transaction context.
UnitOfWorkImpl uow = getUnitOfWork();
try {
// Log the fact that we got invoked
getTransactionController().logTxStateTrace(uow, "TX_afterCompletion", status);
//Cr#3452053
session.startOperationProfile(SessionProfiler.JtsAfterCompletion);
// The uow should still be active even in rollback case
if (!uow.isActive()) {
throw TransactionException.inactiveUnitOfWork(uow);
}
// Only do merge if txn was committed
if (getTransactionController().canMergeUnitOfWork_impl(status)) {
uow.afterTransaction(true, true);// committed=true; externalTxn=true
if (uow.isMergePending()) {
// uow in PENDING_MERGE state, merge clones
uow.mergeClonesAfterCompletion();
}
} else {
uow.afterTransaction(false, true);// committed=false; externalTxn=true
}
} catch (RuntimeException rtEx) {
// First log the exception so it gets seen
uow.log(new SessionLogEntry(uow, SessionLog.WARNING, SessionLog.TRANSACTION, rtEx));
// Rethrow it just for fun (app servers tend to ignore them at this stage)
throw rtEx;
} finally {
session.endOperationProfile(SessionProfiler.JtsAfterCompletion);
}
// Clean up by releasing the uow and client session
if (uow.shouldResumeUnitOfWorkOnTransactionCompletion() && getTransactionController().canMergeUnitOfWork_impl(status)){
uow.synchronizeAndResume();
uow.setSynchronized(false);
}else{
uow.release();
// Release the session explicitly
if (getSession().isClientSession()) {
getSession().release();
}
}
getTransactionController().removeUnitOfWork(getTransaction());
setUnitOfWork(null);
setTransaction(null);
setSession(null);
|
public void | beforeCompletion()INTERNAL:
This method performs the logic that occurs at transaction
completion time. This includes issuing the SQL, etc.
This method executes within the transaction context of the caller of
transaction.commit(), or in the case of container-managed transactions,
in the context of the method for which the Container started the transaction.
UnitOfWorkImpl uow = getUnitOfWork();
try {
Object status = getTransactionController().getTransactionStatus();
getTransactionController().logTxStateTrace(uow, "TX_beforeCompletion", status);
//CR# 3452053
session.startOperationProfile(SessionProfiler.JtsBeforeCompletion);
// If the uow is not active then somebody somewhere messed up
if (!uow.isActive()) {
throw TransactionException.inactiveUnitOfWork(uow);
}
// Bail out if we don't think we should actually issue the SQL
if (!getTransactionController().canIssueSQLToDatabase_impl(status)) {
return;
}
// Must force concurrency mgrs active thread if in nested transaction
if (getSession().isInTransaction()) {
getSession().getTransactionMutex().setActiveThread(Thread.currentThread());
}
// Send the SQL to the DB
uow.issueSQLbeforeCompletion();
// Fix up our merge state in the unit of work and the session
uow.setPendingMerge();
} catch (RuntimeException exception) {
// Something went wrong (probably while sending SQL to the database).
uow.log(new SessionLogEntry(uow, SessionLog.WARNING, SessionLog.TRANSACTION, exception));
// Handle the exception according to transaction manager requirements
handleException(exception);
} finally {
session.endOperationProfile(SessionProfiler.JtsBeforeCompletion);
}
|
protected oracle.toplink.essentials.internal.sessions.AbstractSession | getSession()
return session;
|
protected java.lang.Object | getTransaction()
return transaction;
|
protected oracle.toplink.essentials.transaction.AbstractTransactionController | getTransactionController()
return controller;
|
protected oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl | getUnitOfWork()
return unitOfWork;
|
public void | handleException(java.lang.RuntimeException exception)INTERNAL:
Do the appropriate thing for when an exception occurs during SQL issuance.
The default thing to do is to simply mark the transaction to be rolled back,
for those transaction managers that support this, and rethrow the exception.
We hope that the exception will do the trick for those that do not allow
marking rollback.
This method may optionally be overridden by concrete subclass implementations.
Different transaction manager vendors may have different reactions to exceptions
that get signalled during the commit phase of synchronization.
// Don't do this just yet, since some may not be able to handle it
// getTransactionController().markTransactionForRollback();
throw exception;
|
protected void | setSession(oracle.toplink.essentials.internal.sessions.AbstractSession session)
this.session = session;
|
protected void | setTransaction(java.lang.Object transaction)
this.transaction = transaction;
|
protected void | setTransactionController(oracle.toplink.essentials.transaction.AbstractTransactionController newController)
controller = newController;
|
protected void | setUnitOfWork(oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl unitOfWork)
this.unitOfWork = unitOfWork;
|