Package org.apache.activemq.util.Wait

Examples of org.apache.activemq.util.Wait.Condition


        MessageProducer producer = session.createProducer(new ActiveMQTopic("VirtualTopic.T"));
        for (int i=0; i<maxSent; i++) {
            producer.send(session.createTextMessage("Hi" + i));
        }
       
        Wait.waitFor(new Condition() {
            public boolean isSatisified() throws Exception {
                return maxSent == counterA.getCount() && maxSent == counterB.getCount();
            }
        });
        assertEquals(maxSent, counterA.getCount());
View Full Code Here


        RegionBroker regionBroker = (RegionBroker) BrokerRegistry.getInstance().lookup("localhost").getRegionBroker();
        for (org.apache.activemq.broker.region.Destination dest : regionBroker.getQueueRegion().getDestinationMap().values()) {
            final org.apache.activemq.broker.region.Destination target = dest;
            if (dest.getName().equals(destination)) {
                try {
                    Wait.waitFor(new Condition() {
                        public boolean isSatisified() throws Exception {
                            DestinationStatistics stats = target.getDestinationStatistics();
                            LOG.info("inflight for : " + target.getName() + ": " +  stats.getInflight().getCount());
                            return stats.getInflight().getCount() == expectedCount;
                        }
View Full Code Here

        MessageProducer producer = session.createProducer(new ActiveMQTopic("VirtualTopic.T"));
        for (int i=0; i<maxSent; i++) {
            producer.send(session.createTextMessage("Hi" + i));
        }
       
        Wait.waitFor(new Condition() {
            public boolean isSatisified() throws Exception {
                return maxSent == counterA.getCount() && maxSent == counterB.getCount();
            }
        });
        assertEquals(maxSent, counterA.getCount());
View Full Code Here

        return broker;
    }

    public void testDestinationGc() throws Exception {
        assertEquals(1, broker.getAdminView().getQueues().length);
        assertTrue("After GC runs the Queue should be empty.", Wait.waitFor(new Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                return broker.getAdminView().getQueues().length == 0;
            }
        }));
View Full Code Here

        assertEquals(5, broker.getAdminView().getQueues().length);
        Thread.sleep(7000);
        int queues = broker.getAdminView().getQueues().length;
        assertTrue(queues > 0 && queues < 5);
        assertTrue("After GC runs the Queue should be empty.", Wait.waitFor(new Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                return broker.getAdminView().getQueues().length == 0;
            }
        }));
View Full Code Here

        RegionBroker regionBroker = (RegionBroker) BrokerRegistry.getInstance().lookup("localhost").getRegionBroker();
        for (org.apache.activemq.broker.region.Destination dest : regionBroker.getQueueRegion().getDestinationMap().values()) {
            final org.apache.activemq.broker.region.Destination target = dest;
            if (dest.getName().equals(destination)) {
                try {
                    Wait.waitFor(new Condition() {
                        public boolean isSatisified() throws Exception {
                            DestinationStatistics stats = target.getDestinationStatistics();
                            LOG.info("inflight for : " + target.getName() + ": " +  stats.getInflight().getCount());
                            return stats.getInflight().getCount() == expectedCount;
                        }
View Full Code Here

            LOG.info("producer successful, count = " + producerAllFail.getLatch().getCount());
            LOG.info("final message list size =  " + messageList.size());

            assertTrue("message list size =  " + messageList.size() + " exptected:" + totalNumberMessages,
                Wait.waitFor(new Condition() {
                    @Override
                    public boolean isSatisified() throws Exception {
                        return totalNumberMessages == messageList.size();
                    }
                }));
View Full Code Here

        RegionBroker regionBroker = (RegionBroker) BrokerRegistry.getInstance().lookup("localhost").getRegionBroker();
        for (org.apache.activemq.broker.region.Destination dest : regionBroker.getQueueRegion().getDestinationMap().values()) {
            final org.apache.activemq.broker.region.Destination target = dest;
            if (dest.getName().equals(destination)) {
                try {
                    Wait.waitFor(new Condition() {
                        public boolean isSatisified() throws Exception {
                            DestinationStatistics stats = target.getDestinationStatistics();
                            LOG.info("inflight for : " + target.getName() + ": " +  stats.getInflight().getCount());
                            return stats.getInflight().getCount() == expectedCount;
                        }
View Full Code Here

        });
        connection.start();

        TimeUnit.SECONDS.sleep(5);

        assertTrue("After GC runs there should be one Queue.", Wait.waitFor(new Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                return broker.getAdminView().getQueues().length == 1;
            }
        }));
View Full Code Here

        connection.close();
    }

    public void testDestinationGc() throws Exception {
        assertEquals(1, broker.getAdminView().getQueues().length);
        assertTrue("After GC runs the Queue should be empty.", Wait.waitFor(new Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                return broker.getAdminView().getQueues().length == 0;
            }
        }));
View Full Code Here

TOP

Related Classes of org.apache.activemq.util.Wait.Condition

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.