Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.Transaction


    /**
     * @see org.codehaus.activemq.service.TransactionManager#getXATransaction(org.codehaus.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

    /**
     * rollback a transaction
     */
    public void rollbackTransaction(BrokerClient client, String transactionId) throws JMSException {
        try {
            Transaction transaction = transactionManager.getLocalTransaction(transactionId);
            transaction.rollback();
        }
        catch (XAException e) {
            // TODO: I think the XAException should propagate all the way to the client.
            throw (JMSException) new JMSException(e.getMessage()).initCause(e);
        }
View Full Code Here

     * Prepares an XA Transaciton.
     *
     * @see org.codehaus.activemq.broker.Broker#prepareTransaction(org.codehaus.activemq.broker.BrokerClient, org.codehaus.activemq.message.ActiveMQXid)
     */
    public int prepareTransaction(BrokerClient client, ActiveMQXid xid) throws XAException {
        Transaction transaction = transactionManager.getXATransaction(xid);
        return transaction.prepare();
    }
View Full Code Here

     * Rollback an XA Transaction.
     *
     * @see org.codehaus.activemq.broker.Broker#rollbackTransaction(org.codehaus.activemq.broker.BrokerClient, org.codehaus.activemq.message.ActiveMQXid)
     */
    public void rollbackTransaction(BrokerClient client, ActiveMQXid xid) throws XAException {
        Transaction transaction = transactionManager.getXATransaction(xid);
        transaction.rollback();
    }
View Full Code Here

     * Commit an XA Transaction.
     *
     * @see org.codehaus.activemq.broker.Broker#commitTransaction(org.codehaus.activemq.broker.BrokerClient, org.codehaus.activemq.message.ActiveMQXid, boolean)
     */
    public void commitTransaction(BrokerClient client, ActiveMQXid xid, boolean onePhase) throws XAException {
        Transaction transaction = transactionManager.getXATransaction(xid);
        transaction.commit(onePhase);
    }
View Full Code Here

     * the Transactio ncan be obtained via TransactionManager.getContexTransaction().
     * @param message
     * @throws JMSException
     */
    private void associateTransaction(ActiveMQMessage message) throws JMSException {
        Transaction transaction;
        if( message.isPartOfTransaction() ) {
            if (message.isXaTransacted()) {
                try {
                    transaction = transactionManager.getXATransaction((ActiveMQXid) message.getTransactionId());
                }
View Full Code Here

     * the Transactio ncan be obtained via TransactionManager.getContexTransaction().
     * @param ack
     * @throws JMSException
     */
    private void associateTransaction(MessageAck ack) throws JMSException {
        Transaction transaction;
        if( ack.isPartOfTransaction() ) {
            if (ack.isXaTransacted()) {
                try {
                    transaction = transactionManager.getXATransaction((ActiveMQXid) ack.getTransactionId());
                }
View Full Code Here

        transactionManager.createLocalTransaction(client, transactionId);
    }

    public void commitTransaction(BrokerClient client, String transactionId) throws JMSException {
        try {
            Transaction transaction = transactionManager.getLocalTransaction(transactionId);
            transaction.commit(true);
        }
        catch (XAException e) {
            // TODO: I think the XAException should propagate all the way to the client.
            throw (JMSException) new JMSException(e.getMessage()).initCause(e);
        }
View Full Code Here

TOP

Related Classes of org.codehaus.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.