本文整理匯總了Java中javax.transaction.Transaction.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Transaction.equals方法的具體用法?Java Transaction.equals怎麽用?Java Transaction.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.transaction.Transaction
的用法示例。
在下文中一共展示了Transaction.equals方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: markTransactionAsRollbackOnly
import javax.transaction.Transaction; //導入方法依賴的package包/類
private void markTransactionAsRollbackOnly(Method method) throws Exception {
Transaction currentTx = _transactionManager.getTransaction();
if (_logger.isDebugEnabled()) {
_logger.debug(String.format("%s is marking the transaction as rollback only: currentTx=%s, startedTx=%s, suspendedTx=%s",
Thread.currentThread().getName(), currentTx, _startedTx, _suspendedTx));
}
if (_startedTx != null) {
if (currentTx != null && currentTx.equals(_startedTx)) {
currentTx.setRollbackOnly();
} else {
// Suspend any bad transaction - there is bug somewhere, but we will try to tidy things up
JCALogger.ROOT_LOGGER.currentTransactionIsNotSameAsThe(currentTx, _startedTx.toString());
Transaction origTx = _transactionManager.suspend();
try {
_transactionManager.resume(_startedTx);
_startedTx.setRollbackOnly();
} finally {
// Resume any suspended transaction
if (origTx != null) {
try {
_transactionManager.suspend();
_transactionManager.resume(origTx);
} catch (Throwable t) {
JCALogger.ROOT_LOGGER.messageEndpointFailedToResumeOldTransaction(_delegate.toString(), origTx.toString());
}
}
}
}
} else if (_messageEndpointFactory.isDeliveryTransacted(method)
&& currentTx != null && currentTx.getStatus() == Status.STATUS_ACTIVE) {
// Set rollback only flag on a source managed Tx
currentTx.setRollbackOnly();
}
}