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


Java XAResource.XA_RDONLY屬性代碼示例

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


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

示例1: prepare

/**
 * Prepare the transaction TODO: Store prepare results
 * 
 * @return - the tx code
 */
@SuppressWarnings("unchecked")
public int prepare() throws IndexerException
{
    boolean isPrepared = true;
    boolean isModified = false;
    Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
    if (indexers != null)
    {
        for (LuceneIndexer indexer : indexers.values())
        {
            try
            {
                isModified |= indexer.isModified();
                indexer.prepare();
            }
            catch (IndexerException e)
            {
                isPrepared = false;
                throw new IndexerException("Failed to prepare: requires rollback", e);
            }
        }
    }
    if (isPrepared)
    {
        if (isModified)
        {
            return XAResource.XA_OK;
        }
        else
        {
            return XAResource.XA_RDONLY;
        }
    }
    else
    {
        throw new IndexerException("Failed to prepare: requires rollback");
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:43,代碼來源:AbstractLuceneIndexerAndSearcherFactory.java

示例2: prepare

/**
 * Prepare to commit At the moment this makes sure we have all the locks TODO: This is not doing proper
 * serialisation against the index as would a data base transaction.
 * 
 * @return the tx state
 * @throws LuceneIndexException
 */
public int prepare() throws LuceneIndexException
{
    if (s_logger.isDebugEnabled())
    {
        s_logger.debug(Thread.currentThread().getName() + " Starting Prepare");
    }
    switch (getStatus().getStatus())
    {
    case Status.STATUS_COMMITTING:
        throw new IndexerException("Unable to prepare: Transaction is committing");
    case Status.STATUS_COMMITTED:
        throw new IndexerException("Unable to prepare: Transaction is commited ");
    case Status.STATUS_ROLLING_BACK:
        throw new IndexerException("Unable to prepare: Transaction is rolling back");
    case Status.STATUS_ROLLEDBACK:
        throw new IndexerException("Unable to prepare: Transaction is aleady rolled back");
    case Status.STATUS_MARKED_ROLLBACK:
        throw new IndexerException("Unable to prepare: Transaction is marked for roll back");
    case Status.STATUS_PREPARING:
        throw new IndexerException("Unable to prepare: Transaction is already preparing");
    case Status.STATUS_PREPARED:
        throw new IndexerException("Unable to prepare: Transaction is already prepared");
    default:
        try
        {
            setStatus(TransactionStatus.PREPARING);
            if (isModified())
            {
                doPrepare();
                if (s_logger.isDebugEnabled())
                {
                    s_logger.debug(Thread.currentThread().getName() + " Waiting to Finish Preparing");
                }                    
            }
            setStatus(TransactionStatus.PREPARED);
            return isModified() ? XAResource.XA_OK : XAResource.XA_RDONLY;
        }
        catch (LuceneIndexException e)
        {
            setRollbackOnly();
            if (s_logger.isDebugEnabled())
            {
                s_logger.debug(Thread.currentThread().getName() + " Prepare Failed", e);
            }
            throw new LuceneIndexException("Index failed to prepare", e);
        }
        catch (Throwable t)
        {
            // If anything goes wrong we try and do a roll back
            rollback();
            if (s_logger.isDebugEnabled())
            {
                s_logger.debug(Thread.currentThread().getName() + " Prepare Failed", t);
            }
            throw new LuceneIndexException("Prepared failed", t);                
        }
        finally
        {
            if (s_logger.isDebugEnabled())
            {
                s_logger.debug(Thread.currentThread().getName() + " Ending Prepare");
            }                
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:72,代碼來源:AbstractLuceneIndexerImpl.java

示例3: prepare

public int prepare(Xid arg0) throws XAException { return XAResource.XA_RDONLY; } 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:1,代碼來源:ManagedConnectionImpl.java


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