Package org.codehaus.activemq.util

Examples of org.codehaus.activemq.util.Callback


            // the stuff we need to checkpoint next time around
            map.clear();
        }

        final ActiveMQMessage[] data = temp;
        transactionTemplate.run(new Callback() {
            public void execute() throws Throwable {
                for (int i = 0, size = data.length; i < size; i++) {
                    longTermStore.addMessage(data[i]);
                }
                if (message != null) {
View Full Code Here


            this.nextMark = null;
            this.addedMessageIds = new LinkedHashMap();
            this.removedMessageLocations = new ArrayList();
        }

        transactionTemplate.run(new Callback() {
            public void execute() throws Throwable {

                // Checkpoint the added messages.
                Iterator iterator = addedMessageIds.keySet().iterator();
                while (iterator.hasNext()) {
View Full Code Here

        ackedLastAckLocations = this.ackedLastAckLocations;
        this.nextMark=null;
        this.ackedLastAckLocations = new HashMap();
    }
   
    transactionTemplate.run(new Callback() {
      public void execute() throws Throwable {
       
        // Checkpoint the acked messages.
        Iterator iterator = ackedLastAckLocations.keySet().iterator();
        while (iterator.hasNext()) {         
View Full Code Here

      addedMessageIdentitys = new ArrayList(this.addedMessageLocations.keySet());
      removedMessageLocations = this.removedMessageLocations;
      this.removedMessageLocations = new ArrayList();
    }
   
    transactionTemplate.run(new Callback() {
      public void execute() throws Throwable {
       
        // Checkpoint the added messages.
        Iterator iterator = addedMessageIdentitys.iterator();
        while (iterator.hasNext()) {         
View Full Code Here

        ExceptionTemplate template = new ExceptionTemplate();

        if (containerManagers != null) {
            for (int i = 0; i < containerManagers.length; i++) {
                final MessageContainerManager containerManager = containerManagers[i];
                template.run(new Callback() {
                    public void execute() throws Throwable {
                        containerManager.stop();
                    }
                });
            }
        }
        if (transactionManager != null) {
            template.run(new Callback() {
                public void execute() throws Throwable {
                    transactionManager.stop();
                }
            });
        }

        template.run(new Callback() {
            public void execute() throws Throwable {
                persistenceAdapter.stop();
            }
        });
View Full Code Here

        super.start();
    }

    public void stop() {
        ExceptionTemplate template = new ExceptionTemplate();
        template.run(new Callback() {
            public void execute() throws Throwable {
                discoveryAgent.stop();
            }
        });
        template.run(new Callback() {
            public void execute() throws Throwable {
                DiscoveryTransportChannel.super.stop();
            }
        });
        Throwable e = template.getFirstException();
View Full Code Here

    protected abstract ActiveMQMessage[] getMessagesToDispatch() throws JMSException;


    protected void doAcknowledgeMessage(final int i) throws JMSException {
        template.run(new Callback() {
            public void execute() throws Throwable {
                acknowledgeMessage(i);
            }
        });
    }
View Full Code Here

        });
    }

    protected void doAddMessage(int i) throws JMSException {
        final ActiveMQMessage message = getMessage(i);
        template.run(new Callback() {
            public void execute() throws Throwable {
                container.addMessage(message);
            }
        });
    }
View Full Code Here

            return new DurableQueueMessageContainerManager(persistenceAapter, new DurableTopicSubscriptionContainerImpl(new RedeliveryPolicy(),new DeadLetterPolicy()), new FilterFactoryImpl(), new DispatcherImpl());
        }
    }

    protected void assertDeliveryList(final int startIndex, final int lastIndex) throws JMSException {
        template.run(new Callback() {
            public void execute() throws Throwable {
                ActiveMQMessage[] messagesToDispatch = getMessagesToDispatch();
                int count = lastIndex - startIndex;
                assertTrue("Not enough messages available to dispatch. Expected: " + count
                        + " messages but was: " + messagesToDispatch.length, messagesToDispatch.length >= count);
View Full Code Here

        container = messageContainerManager.getContainer(destination.getPhysicalName());

        this.subscription = createSubscription();

        template.run(new Callback() {
            public void execute() throws Throwable {
                recover();
            }
        });
    }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.util.Callback

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.