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


Java TransactionId.isXATransaction方法代码示例

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


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

示例1: getTransaction

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
public Transaction getTransaction(ConnectionContext context, TransactionId xid, boolean mightBePrepared) throws JMSException, XAException {
    Map transactionMap = null;
    synchronized (xaTransactions) {
        transactionMap = xid.isXATransaction() ? xaTransactions : context.getTransactions();
    }
    Transaction transaction = (Transaction)transactionMap.get(xid);
    if (transaction != null) {
        return transaction;
    }
    if (xid.isXATransaction()) {
        XAException e = new XAException("Transaction '" + xid + "' has not been started.");
        e.errorCode = XAException.XAER_NOTA;
        throw e;
    } else {
        throw new JMSException("Transaction '" + xid + "' has not been started.");
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:18,代码来源:TransactionBroker.java

示例2: rollback

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
/**
 * @throws IOException
 * @see org.apache.activemq.store.TransactionStore#rollback(TransactionId)
 */
public void rollback(TransactionId txid) throws IOException {
    Tx tx = null;
    synchronized (inflightTransactions) {
        tx = inflightTransactions.remove(txid);
    }
    if (tx != null) {
        synchronized (preparedTransactions) {
            tx = preparedTransactions.remove(txid);
        }
    }
    if (tx != null) {
        if (txid.isXATransaction()) {
            peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_ROLLBACK, txid,
                                                                  false), true);
        } else {
            peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.LOCAL_ROLLBACK,
                                                                  txid, false), true);
        }
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:25,代码来源:JournalTransactionStore.java

示例3: processBeginTransaction

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
@Override
public Response processBeginTransaction(TransactionInfo info) throws Exception {
   final TransactionId txID = info.getTransactionId();

   try {
      internalSession.resetTX(null);
      if (txID.isXATransaction()) {
         Xid xid = OpenWireUtil.toXID(txID);
         internalSession.xaStart(xid);
      } else {
         Transaction transaction = internalSession.newTransaction();
         txMap.put(txID, transaction);
         transaction.addOperation(new TransactionOperationAbstract() {
            @Override
            public void afterCommit(Transaction tx) {
               txMap.remove(txID);
            }
         });
      }
   } finally {
      internalSession.resetTX(null);
   }
   return null;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:OpenWireConnection.java

示例4: processForgetTransaction

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
@Override
public Response processForgetTransaction(TransactionInfo info) throws Exception {
   TransactionId txID = info.getTransactionId();

   if (txID.isXATransaction()) {
      try {
         Xid xid = OpenWireUtil.toXID(info.getTransactionId());
         internalSession.xaForget(xid);
      } catch (Exception e) {
         ActiveMQServerLogger.LOGGER.warn("Error during method invocation", e);
         throw e;
      }
   } else {
      txMap.remove(txID);
   }

   return null;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:OpenWireConnection.java

示例5: processPrepareTransaction

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
@Override
public Response processPrepareTransaction(TransactionInfo info) throws Exception {
   TransactionId txID = info.getTransactionId();

   try {
      if (txID.isXATransaction()) {
         try {
            Xid xid = OpenWireUtil.toXID(info.getTransactionId());
            internalSession.xaPrepare(xid);
         } catch (Exception e) {
            ActiveMQServerLogger.LOGGER.warn("Error during method invocation", e);
            throw e;
         }
      } else {
         Transaction tx = lookupTX(txID, null);
         tx.prepare();
      }
   } finally {
      internalSession.resetTX(null);
   }

   return new IntegerResponse(XAResource.XA_RDONLY);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:OpenWireConnection.java

示例6: processEndTransaction

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
@Override
public Response processEndTransaction(TransactionInfo info) throws Exception {
   TransactionId txID = info.getTransactionId();

   if (txID.isXATransaction()) {
      try {
         Transaction tx = lookupTX(txID, null);
         internalSession.resetTX(tx);
         try {
            Xid xid = OpenWireUtil.toXID(info.getTransactionId());
            internalSession.xaEnd(xid);
         } finally {
            internalSession.resetTX(null);
         }
      } catch (Exception e) {
         ActiveMQServerLogger.LOGGER.warn("Error during method invocation", e);
         throw e;
      }
   } else {
      txMap.remove(txID);
   }

   return null;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:OpenWireConnection.java

示例7: lookupTX

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
private Transaction lookupTX(TransactionId txID, AMQSession session, boolean remove) throws IllegalStateException {
   if (txID == null) {
      return null;
   }

   Xid xid = null;
   Transaction transaction;
   if (txID.isXATransaction()) {
      xid = OpenWireUtil.toXID(txID);
      transaction = remove ? server.getResourceManager().removeTransaction(xid) : server.getResourceManager().getTransaction(xid);
   } else {
      transaction = remove ? txMap.remove(txID) : txMap.get(txID);
   }

   if (transaction == null) {
      return null;
   }

   if (session != null && transaction.getProtocolData() != session) {
      transaction.setProtocolData(session);
   }

   return transaction;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:OpenWireConnection.java

示例8: commit

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
/**
 * @throws XAException
 * @see org.apache.activemq.store.TransactionStore#commit(org.apache.activemq.service.Transaction)
 */
public void commit(TransactionId txid, boolean wasPrepared, Runnable preCommit,Runnable postCommit) throws IOException {
    Tx tx;
    if (preCommit != null) {
        preCommit.run();
    }
    if (wasPrepared) {
        synchronized (preparedTransactions) {
            tx = preparedTransactions.remove(txid);
        }
    } else {
        synchronized (inflightTransactions) {
            tx = inflightTransactions.remove(txid);
        }
    }
    if (tx == null) {
        if (postCommit != null) {
            postCommit.run();
        }
        return;
    }
    if (txid.isXATransaction()) {
        peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.XA_COMMIT, txid,
                                                              wasPrepared), true);
    } else {
        peristenceAdapter.writeCommand(new JournalTransaction(JournalTransaction.LOCAL_COMMIT, txid,
                                                              wasPrepared), true);
    }
    if (postCommit != null) {
        postCommit.run();
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:36,代码来源:JournalTransactionStore.java

示例9: prepare

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
/**
 * @throws IOException
 * @see org.apache.activemq.store.TransactionStore#prepare(TransactionId)
 */
public void prepare(TransactionId txid) throws IOException {
    KahaTransactionInfo info = getTransactionInfo(txid);
    if (txid.isXATransaction() || theStore.isConcurrentStoreAndDispatchTransactions() == false) {
        theStore.store(new KahaPrepareCommand().setTransactionInfo(info), true, null, null);
    } else {
        Tx tx = inflightTransactions.remove(txid);
        if (tx != null) {
           theStore.store(new KahaPrepareCommand().setTransactionInfo(info), true, null, null);
        }
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:16,代码来源:KahaDBTransactionStore.java

示例10: rollback

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
/**
 * @throws IOException
 * @see org.apache.activemq.store.TransactionStore#rollback(TransactionId)
 */
public void rollback(TransactionId txid) throws IOException {
    if (txid.isXATransaction() || theStore.isConcurrentStoreAndDispatchTransactions() == false) {
        KahaTransactionInfo info = getTransactionInfo(txid);
        theStore.store(new KahaRollbackCommand().setTransactionInfo(info), false, null, null);
        forgetRecoveredAcks(txid);
    } else {
        inflightTransactions.remove(txid);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:14,代码来源:KahaDBTransactionStore.java

示例11: forgetRecoveredAcks

import org.apache.activemq.command.TransactionId; //导入方法依赖的package包/类
protected void forgetRecoveredAcks(TransactionId txid) throws IOException {
    if (txid.isXATransaction()) {
        XATransactionId xaTid = ((XATransactionId) txid);
        theStore.forgetRecoveredAcks(xaTid.getPreparedAcks());
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:7,代码来源:KahaDBTransactionStore.java


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