Methods Summary |
---|
public void | begin()
if (begun) {
return;
}
log.debug("begin");
boolean synchronization = jdbcContext.registerSynchronizationIfPossible();
if ( !synchronization ) {
throw new TransactionException("Could not register synchronization for container transaction");
}
begun = true;
jdbcContext.afterTransactionBegin(this);
|
public void | commit()
if (!begun) {
throw new TransactionException("Transaction not successfully started");
}
log.debug("commit");
boolean flush = !transactionContext.isFlushModeNever() &&
!transactionContext.isFlushBeforeCompletionEnabled();
if (flush) {
transactionContext.managedFlush(); //if an exception occurs during flush, user must call rollback()
}
begun = false;
|
public javax.transaction.Transaction | getTransaction()
return transactionContext.getFactory().getTransactionManager().getTransaction();
|
public boolean | isActive()
if (!begun) return false;
final int status;
try {
status = getTransaction().getStatus();
}
catch (SystemException se) {
log.error("Could not determine transaction status", se);
throw new TransactionException("Could not determine transaction status: ", se);
}
if (status==Status.STATUS_UNKNOWN) {
throw new TransactionException("Could not determine transaction status");
}
else {
return status==Status.STATUS_ACTIVE;
}
|
public void | registerSynchronization(javax.transaction.Synchronization sync)
try {
getTransaction().registerSynchronization(sync);
}
catch (Exception e) {
throw new TransactionException("Could not register synchronization", e);
}
|
public void | rollback()
if (!begun) {
throw new TransactionException("Transaction not successfully started");
}
log.debug("rollback");
try {
getTransaction().setRollbackOnly();
}
catch (SystemException se) {
log.error("Could not set transaction to rollback only", se);
throw new TransactionException("Could not set transaction to rollback only", se);
}
begun = false;
|
public void | setTimeout(int seconds)
throw new UnsupportedOperationException("cannot set transaction timeout in CMT");
|
public boolean | wasCommitted()
if ( !begun ) return false;
final int status;
try {
status = getTransaction().getStatus();
}
catch (SystemException se) {
log.error("Could not determine transaction status", se);
throw new TransactionException("Could not determine transaction status: ", se);
}
if (status==Status.STATUS_UNKNOWN) {
throw new TransactionException("Could not determine transaction status");
}
else {
return status==Status.STATUS_COMMITTED;
}
|
public boolean | wasRolledBack()
if (!begun) return false;
final int status;
try {
status = getTransaction().getStatus();
}
catch (SystemException se) {
log.error("Could not determine transaction status", se);
throw new TransactionException("Could not determine transaction status", se);
}
if (status==Status.STATUS_UNKNOWN) {
throw new TransactionException("Could not determine transaction status");
}
else {
return JTAHelper.isRollback(status);
}
|