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


Java XAResource.TMRESUME屬性代碼示例

本文整理匯總了Java中javax.transaction.xa.XAResource.TMRESUME屬性的典型用法代碼示例。如果您正苦於以下問題:Java XAResource.TMRESUME屬性的具體用法?Java XAResource.TMRESUME怎麽用?Java XAResource.TMRESUME使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.transaction.xa.XAResource的用法示例。


在下文中一共展示了XAResource.TMRESUME屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

public void start(Xid xid, int flag) throws XAException {
    if (flag == XAResource.TMNOFLAGS) {
        // first time in this transaction
        if (this.xid != null) {
            throw new XAException("already enlisted");
        }
        this.xid = xid;
        try {
            localTransaction.begin();
        } catch (ResourceException e) {
            throw (XAException) new XAException("could not start local tx").initCause(e);
        }
    } else if (flag == XAResource.TMRESUME) {
        if (xid != this.xid) {
            throw new XAException("attempting to resume in different transaction");
        }
    } else {
        throw new XAException("unknown state");
    }
}
 
開發者ID:ops4j,項目名稱:org.ops4j.pax.transx,代碼行數:20,代碼來源:LocalXAResource.java

示例2: start

public void start(Xid xid, int flag) throws XAException
{
    Map<StoreRef, LuceneIndexer> active = activeIndexersInGlobalTx.get(xid);
    Map<StoreRef, LuceneIndexer> suspended = suspendedIndexersInGlobalTx.get(xid);
    if (flag == XAResource.TMJOIN)
    {
        // must be active
        if ((active != null) && (suspended == null))
        {
            return;
        }
        else
        {
            throw new XAException("Trying to rejoin transaction in an invalid state");
        }

    }
    else if (flag == XAResource.TMRESUME)
    {
        // must be suspended
        if ((active == null) && (suspended != null))
        {
            suspendedIndexersInGlobalTx.remove(xid);
            activeIndexersInGlobalTx.put(xid, suspended);
            return;
        }
        else
        {
            throw new XAException("Trying to rejoin transaction in an invalid state");
        }

    }
    else if (flag == XAResource.TMNOFLAGS)
    {
        if ((active == null) && (suspended == null))
        {
            return;
        }
        else
        {
            throw new XAException("Trying to start an existing or suspended transaction");
        }
    }
    else
    {
        throw new XAException("Unkown flags for start " + flag);
    }

}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:49,代碼來源:AbstractLuceneIndexerAndSearcherFactory.java


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