本文整理汇总了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;
}
}