Package org.codehaus.activemq.service

Examples of org.codehaus.activemq.service.TransactionTask


    public void sendMessage(final BrokerClient client, final ActiveMQMessage message) throws JMSException {
        if (TransactionManager.getContexTransaction()==AutoCommitTransaction.AUTO_COMMIT_TRANSACTION){
            doSendMessage(client, message);
        }else {
            // If there is no transaction.. then this executes directly.
            TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    doSendMessage(client, message);
                }
            });
        }
View Full Code Here


                throw xae;
        }

        // Run the prePrepareTasks
        for (Iterator iter = prePrepareTasks.iterator(); iter.hasNext();) {
            TransactionTask r = (TransactionTask) iter.next();
            r.execute(broker);
        }
    }
View Full Code Here

    }

    protected void postCommit() throws Throwable {
        // Run the postCommitTasks
        for (Iterator iter = postCommitTasks.iterator(); iter.hasNext();) {
            TransactionTask r = (TransactionTask) iter.next();
            r.execute(broker);
        }
    }
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(broker);
        }
    }
View Full Code Here

                messagePtrs.remove(queueEntry);
                lastMessagePointersPerContainer.put(pointer.getContainer(), pointer);
                unconsumedMessagesDispatched.decrement();

                TransactionManager.getContexTransaction().addPostRollbackTask(new TransactionTask(){
                    public void execute() throws Throwable {                       
                        unconsumedMessagesDispatched.increment();
                        MessagePointer p = new MessagePointer(pointer.getContainer(), pointer.getMessageIdentity());
                        p.setRedelivered(true);
                        messagePtrs.add(p);
                        dispatch.wakeup(DurableTopicSubscription.this);
                        lastMessageIdentity = pointer.getMessageIdentity();
                    }
                });

                TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
                    public void execute() throws Throwable {                       
                        // now lets tell each container to update its lastAcknowlegedMessageID
                        for (Iterator iter = lastMessagePointersPerContainer.entrySet().iterator(); iter.hasNext();) {
                            Map.Entry entry = (Map.Entry) iter.next();
                            TopicMessageContainer container = (TopicMessageContainer) entry.getKey();
View Full Code Here

        ActiveMQDestination destination = message.getJMSActiveMQDestination();
        if ( !destination.isQueue() || !message.isTemporary() )
            return;

            // If there is no transaction.. then this executes directly.
        TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
            public void execute() throws Throwable {
                doSendMessage(client, message);
            }
        });
    }
View Full Code Here

     */
    public void acknowledgeMessage(final BrokerClient client, final MessageAck ack) throws JMSException {
        final TransientQueueSubscription ts = (TransientQueueSubscription) subscriptions.get(ack.getConsumerId());
        if (ts != null) {
            // If there is no transaction.. then this executes directly.
            TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
                public void execute() throws Throwable {
                    doAcknowledgeMessage(ts, ack);
                }
            });       
            TransactionManager.getContexTransaction().addPostRollbackTask(new TransactionTask(){
                public void execute() throws Throwable {
                    redeliverMessage(ts, ack);
                }
            });
        }       
View Full Code Here

       
        if ( message == null || !message.getJMSActiveMQDestination().isTopic())
            return;

            // If there is no transaction.. then this executes directly.
        TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
            public void execute() throws Throwable {
                doSendMessage(client, message);
            }
        });
    }
View Full Code Here

                }           

                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(pointer.getMessageIdentity());
View Full Code Here

        // subscribers as they may come along later
        // plus we don't pre-load subscription information
        final MessageContainer container = getContainer(message.getJMSDestination().toString());
        container.addMessage(message);

        TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
            public void execute() throws Throwable {
                doSendMessage(client, message, container);
            }
        });
    }
View Full Code Here

TOP

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