當前位置: 首頁>>代碼示例>>Java>>正文


Java TransactionStatus.isRollbackOnly方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-core,代碼行數:37,代碼來源:SpringAwareUserTransaction.java


注:本文中的org.springframework.transaction.TransactionStatus.isRollbackOnly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。