Examples of KahaDBPersistenceAdapter


Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        Session s = c.createSession(true, Session.SESSION_TRANSACTED);
        MessageProducer p = s.createProducer(new ActiveMQQueue("Tx"));
        p.send(s.createTextMessage("aa"));

        // kill journal without commit
        KahaDBPersistenceAdapter pa = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
        KahaDBStore store = pa.getStore();

        assertNotNull("last tx location is present " + store.getFirstInProgressTxLocation());

        // test hack, close the journal to ensure no further journal updates when broker stops
        // mimic kill -9 in terms of no normal shutdown sequence
        store.getJournal().close();
        try {
            store.close();
        } catch (Exception expectedLotsAsJournalBorked) {
        }

        broker.stop();
        broker.waitUntilStopped();

        // restart with recovery
        broker = createAndStartBroker(false);

        pa = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
        store = pa.getStore();

        // inflight non xa tx should be rolledback on recovery
        assertNull("in progress tx location is present ", store.getFirstInProgressTxLocation());

    }
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        }
    }
   
    private void configurePersistence(BrokerService broker) throws Exception{
        File dataDirFile = new File("target/" + getName());
        KahaDBPersistenceAdapter kahaDBAdapter = new KahaDBPersistenceAdapter();
        kahaDBAdapter.setDirectory(dataDirFile);
        broker.setPersistenceAdapter(kahaDBAdapter);
    }
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        }

        // allow the clean up thread time to run
        TimeUnit.MINUTES.sleep(2);

        final KahaDBPersistenceAdapter pa = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
        assertTrue("only one journal file should be left ", Wait.waitFor(new Wait.Condition() {

            @Override
            public boolean isSatisified() throws Exception {
                return pa.getStore().getJournal().getFileMap().size() == 1;
            }
        }, TimeUnit.MINUTES.toMillis(2)));

        LOG.info("DONE.");
    }
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        File kahadbData = new File("activemq-data/" + getName() + "-kahadb");
            if (deleteAllMessages)
                delete(kahadbData);

            broker.setPersistent(true);
            KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter();
            kahadb.setDirectory(kahadbData);
            kahadb.setJournalMaxFileLength500 * 1024);
            broker.setPersistenceAdapter(kahadb);

        connectionUri = broker.addConnector("tcp://localhost:0").getPublishableConnectString();

        broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
 
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        // restart broker one last time
        restartBroker();

        assertTrue("no exceptions: " + exceptions, exceptions.isEmpty());

        final KahaDBPersistenceAdapter pa = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
        assertTrue("only one journal file should be left: " + pa.getStore().getJournal().getFileMap().size(),
            Wait.waitFor(new Wait.Condition() {

                @Override
                public boolean isSatisified() throws Exception {
                    return pa.getStore().getJournal().getFileMap().size() == 1;
                }
            }, TimeUnit.MINUTES.toMillis(3))
        );

        LOG.info("DONE.");
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        File kahadbData = new File("activemq-data/" + getName() + "-kahadb");
        if (deleteAllMessages)
            delete(kahadbData);

        broker.setPersistent(true);
        KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter();
        kahadb.setDirectory(kahadbData);
        kahadb.setJournalMaxFileLength(20 * 1024);
        broker.setPersistenceAdapter(kahadb);

        broker.addConnector("tcp://localhost:61656");

        broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
 
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

    protected void setUp() throws Exception {
        broker = new BrokerService();
        broker.setDataDirectory("target" + File.separator + "test-data" + File.separator + "AMQ2401Test");
        broker.setDeleteAllMessagesOnStartup(true);

        KahaDBPersistenceAdapter kahaDb = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
        kahaDb.setConcurrentStoreAndDispatchQueues(false);
        broker.addConnector("tcp://0.0.0.0:2401");
        PolicyMap policies = new PolicyMap();
        PolicyEntry entry = new PolicyEntry();
        entry.setMemoryLimit(1024 * 1024);
        entry.setProducerFlowControl(true);
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        // check outcome.

        ObjectName[] subscribers = broker.getAdminView().getDurableTopicSubscribers();
        ObjectName[] inactiveSubscribers = broker.getAdminView().getInactiveDurableTopicSubscribers();
        final KahaDBPersistenceAdapter persistenceAdapter = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();

        printDebugClientInfo(subscribers, inactiveSubscribers, persistenceAdapter);

        assertEquals("should have only one inactiveSubscriber subscribed", 1, broker.getAdminView().getInactiveDurableTopicSubscribers().length);
        assertEquals("should be no subscribers subscribed", 0, broker.getAdminView().getDurableTopicSubscribers().length);

        final KahaDBPersistenceAdapter pa = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();
        assertTrue("should be less than 3 journal file left but was: " + persistenceAdapter.getStore().getJournal().getFileMap().size(),
            Wait.waitFor(new Wait.Condition() {

                @Override
                public boolean isSatisified() throws Exception {
                    return pa.getStore().getJournal().getFileMap().size() <= 3;
                }
            }, TimeUnit.MINUTES.toMillis(3)));

        assertTrue("no exceptions: " + exceptions, exceptions.isEmpty());
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        File kahadbData = new File("activemq-data/" + getName() + "-kahadb");
        if (deleteAllMessages)
            delete(kahadbData);

        broker.setPersistent(true);
        KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter();
        kahadb.setDirectory(kahadbData);
        kahadb.setJournalMaxFileLength(512 * 1024);
        broker.setPersistenceAdapter(kahadb);

        broker.addConnector("tcp://localhost:61656");

        broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
 
View Full Code Here

Examples of org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

        SystemUsage systemUsage;
        systemUsage = new SystemUsage();
        systemUsage.getMemoryUsage().setLimit(10 * 1024 * 1024); // Just a few messags
        broker.setSystemUsage(systemUsage);
       
        KahaDBPersistenceAdapter kahaDBPersistenceAdapter = new KahaDBPersistenceAdapter();
        kahaDBPersistenceAdapter.setJournalMaxFileLength(16*1024);
        kahaDBPersistenceAdapter.setCleanupInterval(500);
        broker.setPersistenceAdapter(kahaDBPersistenceAdapter);
       
        broker.start();
        LOG.info("Starting broker..");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.