当前位置: 首页>>代码示例>>Java>>正文


Java XAResource.TMSUSPEND属性代码示例

本文整理汇总了Java中javax.transaction.xa.XAResource.TMSUSPEND属性的典型用法代码示例。如果您正苦于以下问题:Java XAResource.TMSUSPEND属性的具体用法?Java XAResource.TMSUSPEND怎么用?Java XAResource.TMSUSPEND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.transaction.xa.XAResource的用法示例。


在下文中一共展示了XAResource.TMSUSPEND属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: end

public void end(Xid xid, int flag) throws XAException
{
    Map<StoreRef, LuceneIndexer> indexers = activeIndexersInGlobalTx.get(xid);
    if (indexers == null)
    {
        if (suspendedIndexersInGlobalTx.containsKey(xid))
        {
            throw new XAException("Trying to commit indexes for a suspended transaction.");
        }
        else
        {
            // nothing to do
            return;
        }
    }
    if (flag == XAResource.TMSUSPEND)
    {
        activeIndexersInGlobalTx.remove(xid);
        suspendedIndexersInGlobalTx.put(xid, indexers);
    }
    else if (flag == TMFAIL)
    {
        activeIndexersInGlobalTx.remove(xid);
        suspendedIndexersInGlobalTx.remove(xid);
    }
    else if (flag == TMSUCCESS)
    {
        activeIndexersInGlobalTx.remove(xid);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例2: end

/**
 * Preconditions: 1. Flags is one of TMSUCCESS, TMFAIL, TMSUSPEND 2. xid !=
 * null 3. Connection is associated with transaction xid
 *
 * Implementation deficiency preconditions: 1. Flags is not TMSUSPEND
 *
 * Postconditions: 1. connection is disassociated from the transaction.
 * 
 * @see XAResource#end(Xid, int)
 */
@Override
public void end(Xid xid, int flags) throws XAException
{
	if (logger.logDebug())
	{
		debug("ending transaction xid = " + xid);
	}

	// Check preconditions

	if (flags != XAResource.TMSUSPEND && flags != XAResource.TMFAIL && flags != XAResource.TMSUCCESS)
	{
		throw new CloudSpannerXAException("Invalid flags", Code.INVALID_ARGUMENT, XAException.XAER_INVAL);
	}

	if (xid == null)
	{
		throw new CloudSpannerXAException("xid must not be null", Code.INVALID_ARGUMENT, XAException.XAER_INVAL);
	}

	if (state != STATE_ACTIVE || !currentXid.equals(xid))
	{
		throw new CloudSpannerXAException("tried to call end without corresponding start call",
				Code.FAILED_PRECONDITION, XAException.XAER_PROTO);
	}

	// Check implementation deficiency preconditions
	if (flags == XAResource.TMSUSPEND)
	{
		throw new CloudSpannerXAException("suspend/resume not implemented", Code.UNIMPLEMENTED,
				XAException.XAER_RMERR);
	}

	// We ignore TMFAIL. It's just a hint to the RM. We could roll back
	// immediately
	// if TMFAIL was given.

	// All clear. We don't have any real work to do.
	state = STATE_ENDED;
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:50,代码来源:CloudSpannerXAConnection.java


注:本文中的javax.transaction.xa.XAResource.TMSUSPEND属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。