Package org.apache.activemq.broker.region

Examples of org.apache.activemq.broker.region.Queue$OrderedNonTransactionWorkTx


        final TestMessageStore queueMessageStore = new TestMessageStore(messages, destination);
        final ConsumerInfo consumerInfo = new ConsumerInfo();
        final DestinationStatistics destinationStatistics = new DestinationStatistics();
        consumerInfo.setExclusive(true);

        final Queue queue = new Queue(brokerService, destination,
                queueMessageStore, destinationStatistics, null);

        queueMessageStore.start();
        queueMessageStore.registerIndexListener(null);
View Full Code Here


        final TestMessageStore queueMessageStore = new TestMessageStore(messages, destination);
        final ConsumerInfo consumerInfo = new ConsumerInfo();
        final DestinationStatistics destinationStatistics = new DestinationStatistics();
        consumerInfo.setExclusive(true);

        final Queue queue = new Queue(brokerService, destination,
                queueMessageStore, destinationStatistics, null);

        queueMessageStore.start();
        queueMessageStore.registerIndexListener(null);
View Full Code Here

        final TestMessageStore queueMessageStore = new TestMessageStore(messages, destination);
        final ConsumerInfo consumerInfo = new ConsumerInfo();
        final DestinationStatistics destinationStatistics = new DestinationStatistics();
        consumerInfo.setExclusive(true);

        final Queue queue = new Queue(brokerService, destination,
                queueMessageStore, destinationStatistics, null);

        queueMessageStore.start();
        queueMessageStore.registerIndexListener(null);
View Full Code Here

        assertFalse("Cache disabled on q", queueViewMBean.isCacheEnabled());

        // ensure repeated browse does now blow mem

        final Queue underTest = (Queue) ((RegionBroker)broker.getRegionBroker()).getQueueRegion().getDestinationMap().get(bigQueue);

        // do twice to attempt to pull in 2*maxBrowsePageSize which uses up the system memory limit
        Message[] browsed = underTest.browse();
        LOG.info("Browsed: " + browsed.length);
        assertEquals("maxBrowsePageSize", maxBrowsePageSize, browsed.length);
        browsed = underTest.browse();
        LOG.info("Browsed: " + browsed.length);
        assertEquals("maxBrowsePageSize", maxBrowsePageSize, browsed.length);
        Runtime.getRuntime().gc();
        long free = Runtime.getRuntime().freeMemory()/1024;
        LOG.info("free at start of check: " + free);
        // check for memory growth
        for (int i=0; i<10; i++) {
            LOG.info("free: " + Runtime.getRuntime().freeMemory()/1024);
            browsed = underTest.browse();
            LOG.info("Browsed: " + browsed.length);
            assertEquals("maxBrowsePageSize", maxBrowsePageSize, browsed.length);
            Runtime.getRuntime().gc();
            Runtime.getRuntime().gc();
            assertTrue("No growth: " + Runtime.getRuntime().freeMemory()/1024 + " >= " + (free - (free * 0.2)), Runtime.getRuntime().freeMemory()/1024 >= (free - (free * 0.2)));
 
View Full Code Here

  }

  private void assertQueueLength(int len) throws Exception, IOException {
    Set<Destination> destinations = bs.getBroker().getDestinations(
        new ActiveMQQueue(QUEUE_NAME));
    Queue queue = (Queue) destinations.iterator().next();
    assertEquals(len, queue.getMessageStore().getMessageCount());
  }
View Full Code Here

    /**
     * Moves a message back to its original destination
     */
    public boolean retryMessage(String messageId) throws Exception {
        Queue queue = (Queue) destination;
        QueueMessageReference ref = queue.getMessage(messageId);
        Message rc = ref.getMessage();
        if (rc != null) {
            ActiveMQDestination originalDestination = rc.getOriginalDestination();
            if (originalDestination != null) {
                ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
                return queue.moveMessageTo(context, ref, originalDestination);
            }
            else {
                throw new JMSException("No original destination for message: "+ messageId);
            }
        }
View Full Code Here

            throw new JMSException("Could not find message: "+ messageId);
        }
    }

    public int cursorSize() {
        Queue queue = (Queue) destination;
        if (queue.getMessages() != null){
            return queue.getMessages().size();
        }
        return 0;
    }
View Full Code Here

        return 0;
    }


    public boolean doesCursorHaveMessagesBuffered() {
       Queue queue = (Queue) destination;
       if (queue.getMessages() != null){
           return queue.getMessages().hasMessagesBufferedToDeliver();
       }
       return false;

    }
View Full Code Here

    }


    public boolean doesCursorHaveSpace() {
        Queue queue = (Queue) destination;
        if (queue.getMessages() != null){
            return queue.getMessages().hasSpace();
        }
        return false;
    }
View Full Code Here

        return false;
    }


    public long getCursorMemoryUsage() {
        Queue queue = (Queue) destination;
        if (queue.getMessages() != null &&  queue.getMessages().getSystemUsage() != null){
            return queue.getMessages().getSystemUsage().getMemoryUsage().getUsage();
        }
        return 0;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.region.Queue$OrderedNonTransactionWorkTx

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.