本文整理匯總了Java中org.springframework.transaction.TransactionStatus.isRollbackOnly方法的典型用法代碼示例。如果您正苦於以下問題:Java TransactionStatus.isRollbackOnly方法的具體用法?Java TransactionStatus.isRollbackOnly怎麽用?Java TransactionStatus.isRollbackOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.transaction.TransactionStatus
的用法示例。
在下文中一共展示了TransactionStatus.isRollbackOnly方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getStatus
import org.springframework.transaction.TransactionStatus; //導入方法依賴的package包/類
/**
* This status is a combination of the internal status, as recorded during explicit operations,
* and the status provided by the Spring support.
*
* @see Status
*/
public synchronized int getStatus() throws SystemException
{
TransactionInfo txnInfo = getTransactionInfo();
// if the txn info is null, then we are outside a transaction
if (txnInfo == null)
{
return internalStatus; // this is checked in getTransactionInfo
}
// normally the internal status is correct, but we only need to double check
// for the case where the transaction was marked for rollback, or rolledback
// in a deeper transaction
TransactionStatus txnStatus = txnInfo.getTransactionStatus();
if (internalStatus == Status.STATUS_ROLLEDBACK)
{
// explicitly rolled back at some point
return internalStatus;
}
else if (txnStatus.isRollbackOnly())
{
// marked for rollback at some point in the stack
return Status.STATUS_MARKED_ROLLBACK;
}
else
{
// just rely on the internal status
return internalStatus;
}
}