public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception { // the transaction may have already been started. if (xid.isXATransaction()) { XATransaction transaction = null; synchronized (xaTransactions) { transaction = xaTransactions.get(xid); if (transaction != null) { return; } transaction = new XATransaction(transactionStore, (XATransactionId)xid, this, context.getConnectionId()); xaTransactions.put(xid, transaction); } } else { Map<TransactionId, Transaction> transactionMap = context.getTransactions(); Transaction transaction = transactionMap.get(xid); if (transaction != null) { throw new JMSException("Transaction '" + xid + "' has already been started."); } transaction = new LocalTransaction(transactionStore, (LocalTransactionId)xid, context); transactionMap.put(xid, transaction); } }
@Override public void rollback() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("rollback: " + xid + " syncCount: " + size()); } setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); transactionStore.rollback(getTransactionId()); try { fireAfterRollback(); } catch (Throwable e) { LOG.warn("POST ROLLBACK FAILED: ", e); XAException xae = new XAException("POST ROLLBACK FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); throw xae; } }
if (LOG.isDebugEnabled()) { LOG.debug("commit: " + xid + " syncCount: " + size()); prePrepare(); } catch (XAException e) { throw e; } catch (Throwable e) { LOG.warn("COMMIT FAILED: ", e); rollback(); setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); try { transactionStore.commit(getTransactionId(), false, preCommitTask, postCommitTask); this.waitPostCommitDone(postCommitTask); } catch (Throwable t) { LOG.warn("Store COMMIT FAILED: ", t); rollback(); XAException xae = new XAException("STORE COMMIT FAILED: Transaction rolled back"); xae.errorCode = XAException.XA_RBOTHER;
if (LOG.isDebugEnabled()) { LOG.debug("commit: " + xid + " syncCount: " + size()); prePrepare(); } catch (XAException e) { throw e; } catch (Throwable e) { LOG.warn("COMMIT FAILED: ", e); rollback(); setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); try { transactionStore.commit(getTransactionId(), false, preCommitTask, postCommitTask); this.waitPostCommitDone(postCommitTask); } catch (Throwable t) { LOG.warn("Store COMMIT FAILED: ", t); rollback(); XAException xae = new XAException("STORE COMMIT FAILED: Transaction rolled back"); xae.errorCode = XAException.XA_RBOTHER;
@Override public void rollback() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("rollback: " + xid + " syncCount: " + size()); } setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); transactionStore.rollback(getTransactionId()); try { fireAfterRollback(); } catch (Throwable e) { LOG.warn("POST ROLLBACK FAILED: ", e); XAException xae = new XAException("POST ROLLBACK FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); throw xae; } }
public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception { // the transaction may have already been started. if (xid.isXATransaction()) { XATransaction transaction = null; synchronized (xaTransactions) { transaction = xaTransactions.get(xid); if (transaction != null) { return; } transaction = new XATransaction(transactionStore, (XATransactionId)xid, this, context.getConnectionId()); xaTransactions.put(xid, transaction); } } else { Map<TransactionId, Transaction> transactionMap = context.getTransactions(); Transaction transaction = transactionMap.get(xid); if (transaction != null) { throw new JMSException("Transaction '" + xid + "' has already been started."); } transaction = new LocalTransaction(transactionStore, (LocalTransactionId)xid, context); transactionMap.put(xid, transaction); } }
if (LOG.isDebugEnabled()) { LOG.debug("commit: " + xid + " syncCount: " + size()); prePrepare(); } catch (XAException e) { throw e; } catch (Throwable e) { LOG.warn("COMMIT FAILED: ", e); rollback(); setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); try { transactionStore.commit(getTransactionId(), false, preCommitTask, postCommitTask); this.waitPostCommitDone(postCommitTask); } catch (Throwable t) { LOG.warn("Store COMMIT FAILED: ", t); rollback(); XAException xae = new XAException("STORE COMMIT FAILED: Transaction rolled back"); xae.errorCode = XAException.XA_RBOTHER;
@Override public void rollback() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("rollback: " + xid + " syncCount: " + size()); } setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); transactionStore.rollback(getTransactionId()); try { fireAfterRollback(); } catch (Throwable e) { LOG.warn("POST ROLLBACK FAILED: ", e); XAException xae = new XAException("POST ROLLBACK FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); throw xae; } }
public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception { // the transaction may have already been started. if (xid.isXATransaction()) { XATransaction transaction = null; synchronized (xaTransactions) { transaction = xaTransactions.get(xid); if (transaction != null) { return; } transaction = new XATransaction(transactionStore, (XATransactionId)xid, this, context.getConnectionId()); xaTransactions.put(xid, transaction); } } else { Map<TransactionId, Transaction> transactionMap = context.getTransactions(); Transaction transaction = transactionMap.get(xid); if (transaction != null) { throw new JMSException("Transaction '" + xid + "' has already been started."); } transaction = new LocalTransaction(transactionStore, (LocalTransactionId)xid, context); transactionMap.put(xid, transaction); } }
if (LOG.isDebugEnabled()) { LOG.debug("commit: " + xid + " syncCount: " + size()); prePrepare(); } catch (XAException e) { throw e; } catch (Throwable e) { LOG.warn("COMMIT FAILED: ", e); rollback(); setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); try { transactionStore.commit(getTransactionId(), false, preCommitTask, postCommitTask); this.waitPostCommitDone(postCommitTask); } catch (Throwable t) { LOG.warn("Store COMMIT FAILED: ", t); rollback(); XAException xae = new XAException("STORE COMMIT FAILED: Transaction rolled back"); xae.errorCode = XAException.XA_RBOTHER;
@Override public void rollback() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("rollback: " + xid + " syncCount: " + size()); } setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); transactionStore.rollback(getTransactionId()); try { fireAfterRollback(); } catch (Throwable e) { LOG.warn("POST ROLLBACK FAILED: ", e); XAException xae = new XAException("POST ROLLBACK FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); throw xae; } }
public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception { // the transaction may have already been started. if (xid.isXATransaction()) { XATransaction transaction = null; synchronized (xaTransactions) { transaction = xaTransactions.get(xid); if (transaction != null) { return; } transaction = new XATransaction(transactionStore, (XATransactionId)xid, this, context.getConnectionId()); xaTransactions.put(xid, transaction); } } else { Map<TransactionId, Transaction> transactionMap = context.getTransactions(); Transaction transaction = transactionMap.get(xid); if (transaction != null) { throw new JMSException("Transaction '" + xid + "' has already been started."); } transaction = new LocalTransaction(transactionStore, (LocalTransactionId)xid, context); transactionMap.put(xid, transaction); } }
if (LOG.isDebugEnabled()) { LOG.debug("commit: " + xid + " syncCount: " + size()); prePrepare(); } catch (XAException e) { throw e; } catch (Throwable e) { LOG.warn("COMMIT FAILED: ", e); rollback(); setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); transactionStore.commit(getTransactionId(), false,preCommitTask, postCommitTask); this.waitPostCommitDone(postCommitTask); } catch (Throwable t) { LOG.warn("Store COMMIT FAILED: ", t); rollback(); XAException xae = new XAException("STORE COMMIT FAILED: Transaction rolled back."); xae.errorCode = XAException.XA_RBOTHER;
@Override public void rollback() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("rollback: " + xid + " syncCount: " + size()); } setState(Transaction.FINISHED_STATE); context.getTransactions().remove(xid); // Sync on transaction store to avoid out of order messages in the cursor // https://issues.apache.org/activemq/browse/AMQ-2594 synchronized (transactionStore) { transactionStore.rollback(getTransactionId()); try { fireAfterRollback(); } catch (Throwable e) { LOG.warn("POST ROLLBACK FAILED: ", e); XAException xae = new XAException("POST ROLLBACK FAILED"); xae.errorCode = XAException.XAER_RMERR; xae.initCause(e); throw xae; } } }
public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception { // the transaction may have already been started. if (xid.isXATransaction()) { XATransaction transaction = null; synchronized (xaTransactions) { transaction = xaTransactions.get(xid); if (transaction != null) { return; } transaction = new XATransaction(transactionStore, (XATransactionId)xid, this, context.getConnectionId()); xaTransactions.put(xid, transaction); } } else { Map<TransactionId, Transaction> transactionMap = context.getTransactions(); Transaction transaction = transactionMap.get(xid); if (transaction != null) { throw new JMSException("Transaction '" + xid + "' has already been started."); } transaction = new LocalTransaction(transactionStore, (LocalTransactionId)xid, context); transactionMap.put(xid, transaction); } }