本文整理汇总了Java中javax.transaction.xa.XAResource.TMNOFLAGS属性的典型用法代码示例。如果您正苦于以下问题:Java XAResource.TMNOFLAGS属性的具体用法?Java XAResource.TMNOFLAGS怎么用?Java XAResource.TMNOFLAGS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.transaction.xa.XAResource
的用法示例。
在下文中一共展示了XAResource.TMNOFLAGS属性的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");
}
}
示例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);
}
}