Package org.activemq.service

Examples of org.activemq.service.Transaction


     * @see org.activemq.service.TransactionManager#createXATransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid)
     */
    public Transaction createXATransaction(final BrokerClient client, final ActiveMQXid xid) throws XAException {
     
      // The xa transaction may allready be running.
      Transaction tx = (Transaction) xaTxs.get(xid);
      if( tx == null ) {
          if(log.isDebugEnabled())
            log.debug("XA Transaction started: "+xid);
            tx = new XATransactionCommand(xid, xaTxs, transactionStore);
            xaTxs.put(xid, tx);
View Full Code Here


    /**
     * @see org.activemq.service.TransactionManager#getLocalTransaction(String)
     */
    public Transaction getLocalTransaction(String txid) throws JMSException {
        Transaction tx = (Transaction) localTxs.get(txid);
        if (tx == null) {
            throw new JMSException("Transaction '" + txid
                    + "' has not been started.");
        }
        return tx;
View Full Code Here

    /**
     * @see org.activemq.service.TransactionManager#getXATransaction(org.activemq.message.ActiveMQXid)
     */
    public Transaction getXATransaction(ActiveMQXid xid) throws XAException {
        Transaction tx = (Transaction) xaTxs.get(xid);
        if (tx == null) {
            XAException e = new XAException("Transaction '" + xid + "' has not been started.");
            e.errorCode = XAException.XAER_NOTA;
            throw e;
        }
View Full Code Here

        if (list != null) {
            for (int i = 0; i < list.size(); i++) {
                try {
                    Object o = list.get(i);
                    if (o instanceof String) {
                        Transaction t = this.getLocalTransaction((String) o);
                        t.rollback();
                    }
                    else {
                        Transaction t = this.getXATransaction((ActiveMQXid) o);
                        t.rollback();
                    }
                }
                catch (Exception e) {
                    log.warn("ERROR Rolling back disconnected client's transactions: ", e);
                }
View Full Code Here

    public void start() throws JMSException {
        transactionStore.start();
        try {
            transactionStore.recover(new RecoveryListener(){
                public void recover(ActiveMQXid xid, ActiveMQMessage[] addedMessages, MessageAck[] aks) throws JMSException, XAException {
                    Transaction transaction = createXATransaction(null, xid);                   
                    for (int i = 0; i < addedMessages.length; i++) {
                        broker.sendMessage(null, addedMessages[i]);
                    }
                    for (int i = 0; i < aks.length; i++) {
                        broker.acknowledgeMessage(null, aks[i]);                   
                    }
                    transaction.prepare();
                }
            });
        } catch (XAException e) {
            throw JMSExceptionHelper.newJMSException("Recovery Failed: "+e.getMessage(), e);
        }
View Full Code Here

     * @see org.activemq.service.TransactionManager#createXATransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid)
     */
    public Transaction createXATransaction(final BrokerClient client, final ActiveMQXid xid) throws XAException {
     
      // The xa transaction may allready be running.
      Transaction tx = (Transaction) localTxs.get(xid);
      if( tx == null ) {
          if(log.isDebugEnabled())
            log.debug("XA Transaction started: "+xid);
            tx = new XATransactionCommand(xid, xaTxs, transactionStore);
            xaTxs.put(xid, tx);
View Full Code Here

    /**
     * @see org.activemq.service.TransactionManager#getLocalTransaction(String)
     */
    public Transaction getLocalTransaction(String txid) throws JMSException {
        Transaction tx = (Transaction) localTxs.get(txid);
        if (tx == null) {
            throw new JMSException("Transaction '" + txid
                    + "' has not been started.");
        }
        return tx;
View Full Code Here

    /**
     * @see org.activemq.service.TransactionManager#getXATransaction(org.activemq.message.ActiveMQXid)
     */
    public Transaction getXATransaction(ActiveMQXid xid) throws XAException {
        Transaction tx = (Transaction) xaTxs.get(xid);
        if (tx == null) {
            XAException e = new XAException("Transaction '" + xid + "' has not been started.");
            e.errorCode = XAException.XAER_NOTA;
            throw e;
        }
View Full Code Here

        if (list != null) {
            for (int i = 0; i < list.size(); i++) {
                try {
                    Object o = list.get(i);
                    if (o instanceof String) {
                        Transaction t = this.getLocalTransaction((String) o);
                        t.rollback();
                    }
                    else {
                        Transaction t = this.getXATransaction((ActiveMQXid) o);
                        t.rollback();
                    }
                }
                catch (Exception e) {
                    log.warn("ERROR Rolling back disconnected client's transactions: ", e);
                }
View Full Code Here

    public void start() throws JMSException {
        transactionStore.start();
        try {
            transactionStore.recover(new RecoveryListener(){
                public void recover(ActiveMQXid xid, ActiveMQMessage[] addedMessages, MessageAck[] aks) throws JMSException, XAException {
                    Transaction transaction = createXATransaction(null, xid);                   
                    for (int i = 0; i < addedMessages.length; i++) {
                        broker.sendMessage(null, addedMessages[i]);
                    }
                    for (int i = 0; i < aks.length; i++) {
                        broker.acknowledgeMessage(null, aks[i]);                   
View Full Code Here

TOP

Related Classes of org.activemq.service.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.