Package org.activemq.service

Examples of org.activemq.service.TransactionTask


    }

    protected void postCommit() throws Throwable {
        // Run the postCommitTasks
        for (Iterator iter = postCommitTasks.iterator(); iter.hasNext();) {
            TransactionTask r = (TransactionTask) iter.next();
            r.execute();
        }
    }
View Full Code Here


    }

    public void postRollback() throws Throwable {
        // Run the postRollbackTasks
        for (Iterator iter = postRollbackTasks.iterator(); iter.hasNext();) {
            TransactionTask r = (TransactionTask) iter.next();
            r.execute();
        }
    }
View Full Code Here

            synchronized (this) {
                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            transactionStore.addMessage(this, message, location);
            tx.addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    synchronized (JournalMessageStore.this) {
                        inFlightTxLocations.remove(location);
                        addMessage(message, location);
                    }
View Full Code Here

            synchronized( this ) {
                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            transactionStore.removeMessage(this, ack, location);
            tx.addPostCommitTask(new TransactionTask(){
                public void execute() throws Throwable {
                    synchronized (JournalMessageStore.this) {
                        inFlightTxLocations.remove(location);
                        removeMessage(ack, location);
                    }
View Full Code Here

                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            JournalAck ack = new JournalAck(destinationName,subscription,messageIdentity.getMessageID(), tx.getTransactionId());
            transactionStore.acknowledge(this, ack, location);
            tx.addPostCommitTask(new TransactionTask(){
                public void execute() throws Throwable {
                    synchronized (JournalTopicMessageStore.this) {
                        inFlightTxLocations.remove(location);
                        acknowledge(subscription, messageIdentity, location);
                    }
View Full Code Here

                        pointer.setRedelivered(true);
                    }
                    else {
                        unconsumedMessagesDispatched.decrement();
                        // We may have to undo the delivery..
                        TransactionManager.getContexTransaction().addPostRollbackTask(new TransactionTask() {
                            public void execute() throws Throwable {
                                unconsumedMessagesDispatched.increment();
                                pointer.reset();
                                pointer.setRedelivered(true);
                                dispatch.wakeup(SubscriptionImpl.this);
                            }
                        });
                        final QueueListEntry theEntry = entry;
                        TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask() {
                            public void execute() throws Throwable {
                                messagePtrs.remove(theEntry);
                                if ((ack.isExpired() || ack.isMessageRead()) && !browser) {
                                    if (ack.isExpired() && !pointer.getContainer().isDeadLetterQueue()) {
                                        ActiveMQMessage msg = pointer.getContainer().getMessage(
View Full Code Here

            // note that we still need to persist the message even if there are no matching
            // subscribers as they may come along later
            // plus we don't pre-load subscription information               
            final MessageContainer container = getContainer(dest.getPhysicalName());
            container.addMessage(message);
            TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    doSendMessage(client, message, container);
                }
            });
        }
View Full Code Here

    public void addMessage(ActiveMQMessage message) throws JMSException {
        messageStore.addMessage(message);
        final MessageIdentity answer = message.getJMSMessageIdentity();
       
        // If there is no transaction.. then this executes directly.
        TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
            public void execute() throws Throwable {
                synchronized( this ) {
                  messagesToBeDelivered.add(answer);
                }
            }
View Full Code Here

    public synchronized void delete(final MessageIdentity messageID, MessageAck ack) throws JMSException {
       
        messageStore.removeMessage(ack);         

        TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
            public void execute() throws Throwable {
              doDelete(messageID);
            }
        });     
       
View Full Code Here

            synchronized (this) {
                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            transactionStore.addMessage(this, message, location);
            tx.addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    if( debug )
                        log.debug("In flight message add commit: "+message.getJMSMessageID()+" at "+location);                       
                    synchronized (JournalMessageStore.this) {
                        inFlightTxLocations.remove(location);
                        addMessage(message, location);
                    }
                }
            });
            tx.addPostRollbackTask(new TransactionTask(){
                public void execute() throws Throwable {
                    if( debug )
                        log.debug("In flight message add rollback: "+message.getJMSMessageID()+" at "+location);                       
                    // TODO Auto-generated method stub
                    synchronized (JournalMessageStore.this) {
View Full Code Here

TOP

Related Classes of org.activemq.service.TransactionTask

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.