Package org.hornetq.core.journal.impl

Examples of org.hornetq.core.journal.impl.JournalImpl$DummyLoader


      ArrayList<RecordInfo> records = new ArrayList<RecordInfo>();

      List<PreparedTransactionInfo> list = new ArrayList<PreparedTransactionInfo>();

      JournalImpl jrn = new JournalImpl(config.getJournalFileSize(),
                                        2,
                                        0,
                                        0,
                                        new NIOSequentialFileFactory(getJournalDir()),
                                        "hornetq-data",
                                        "hq",
                                        1);
      jrn.start();
      jrn.load(records, list, null);

      // Delete everything from the journal
      for (RecordInfo info : records)
      {
         if (!info.isUpdate)
         {
            jrn.appendDeleteRecord(info.id, false);
         }
      }

      jrn.stop();

      server = createServer(true,
                            config,
                            PagingTest.PAGE_SIZE,
                            PagingTest.PAGE_MAX,
View Full Code Here


   // Public --------------------------------------------------------

   public void testSequence() throws Exception
   {
      NIOSequentialFileFactory factory = new NIOSequentialFileFactory(getTestDir());
      Journal journal = new JournalImpl(10 * 1024, 2, 0, 0, factory, "test-data", "tst", 1);

      journal.start();

      journal.load(new ArrayList<RecordInfo>(), new ArrayList<PreparedTransactionInfo>(), null);

      BatchingIDGenerator batch = new BatchingIDGenerator(0, 1000, journal);
      long id1 = batch.generateID();
      long id2 = batch.generateID();

      Assert.assertTrue(id2 > id1);

      journal.stop();
      batch = new BatchingIDGenerator(0, 1000, journal);
      loadIDs(journal, batch);

      long id3 = batch.generateID();

      Assert.assertEquals(1000, id3);

      long id4 = batch.generateID();

      Assert.assertTrue(id4 > id3 && id4 < 2000);

      batch.close();

      journal.stop();
      batch = new BatchingIDGenerator(0, 1000, journal);
      loadIDs(journal, batch);

      long id5 = batch.generateID();
      Assert.assertTrue(id5 > id4 && id5 < 2000);

      long lastId = id5;

      boolean close = true;
      for (int i = 0; i < 100000; i++)
      {
         if (i % 1000 == 0)
         {
            System.out.println("lastId = " + lastId);
            // interchanging closes and simulated crashes
            if (close)
            {
               batch.close();
            }

            close = !close;

            journal.stop();
            batch = new BatchingIDGenerator(0, 1000, journal);
            loadIDs(journal, batch);
         }

         long id = batch.generateID();

         Assert.assertTrue(id > lastId);

         lastId = id;
      }

      batch.close();
      journal.stop();
      batch = new BatchingIDGenerator(0, 1000, journal);
      loadIDs(journal, batch);

      lastId = batch.getCurrentID();

      journal.stop();
      batch = new BatchingIDGenerator(0, 1000, journal);
      loadIDs(journal, batch);

      Assert.assertEquals("No Ids were generated, so the currentID was supposed to stay the same",
                          lastId,
View Full Code Here

    * @throws Exception
    */
   private void printJournal() throws Exception
   {
      NIOSequentialFileFactory factory = new NIOSequentialFileFactory(getJournalDir());
      JournalImpl journal = new JournalImpl(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE,
                                            2,
                                            0,
                                            0,
                                            factory,
                                            "hornetq-data",
                                            "hq",
                                            100);

      ArrayList<RecordInfo> records = new ArrayList<RecordInfo>();
      ArrayList<PreparedTransactionInfo> transactions = new ArrayList<PreparedTransactionInfo>();

      journal.start();
      journal.load(records, transactions, null);

      System.out.println("===============================================");
      System.out.println("Journal records at the end:");

      for (RecordInfo record : records)
      {
         System.out.println(record.id + ", update = " + record.isUpdate);
      }
      journal.stop();
   }
View Full Code Here

      setup(2, 60 * 1024, false);

      final byte recordType = (byte)0;

      journal = new JournalImpl(fileSize, minFiles, 0, 0, fileFactory, filePrefix, fileExtension, maxAIO);

      journal.start();

      journal.loadInternalOnly();

View Full Code Here

      ArrayList<Pair<Long, Long>> transactedRecords = new ArrayList<Pair<Long, Long>>();

      final CountDownLatch latchDone = new CountDownLatch(1);
      final CountDownLatch latchWait = new CountDownLatch(1);
      journal = new JournalImpl(fileSize, minFiles, 0, 0, fileFactory, filePrefix, fileExtension, maxAIO)
      {

         @Override
         protected SequentialFile createControlFile(final List<JournalFile> files,
                                                    final List<JournalFile> newFiles,
View Full Code Here

      final ReusableLatch reusableLatchDone = new ReusableLatch();
      reusableLatchDone.countUp();
      final ReusableLatch reusableLatchWait = new ReusableLatch();
      reusableLatchWait.countUp();

      journal = new JournalImpl(fileSize, minFiles, 0, 0, fileFactory, filePrefix, fileExtension, maxAIO)
      {

         @Override
         public void onCompactDone()
         {
View Full Code Here

      final ReusableLatch reusableLatchDone = new ReusableLatch();
      reusableLatchDone.countUp();
      final ReusableLatch reusableLatchWait = new ReusableLatch();
      reusableLatchWait.countUp();

      journal = new JournalImpl(fileSize, minFiles, 0, 0, fileFactory, filePrefix, fileExtension, maxAIO)
      {

         @Override
         public void onCompactDone()
         {
View Full Code Here

      final ReusableLatch reusableLatchDone = new ReusableLatch();
      reusableLatchDone.countUp();
      final ReusableLatch reusableLatchWait = new ReusableLatch();
      reusableLatchWait.countUp();

      journal = new JournalImpl(fileSize, minFiles, 0, 0, fileFactory, filePrefix, fileExtension, maxAIO)
      {

         @Override
         public void onCompactDone()
         {
View Full Code Here

      createDir = config.isCreateBindingsDir();

      SequentialFileFactory bindingsJMS = new NIOSequentialFileFactory(journalDir);

      Journal localJMS = new JournalImpl(1024 * 1024,
                                              2,
                                              config.getJournalCompactMinFiles(),
                                              config.getJournalCompactPercentage(),
                                              bindingsJMS,
                                              "hornetq-jms",
View Full Code Here

      SequentialFileFactory messagesFF = new NIOSequentialFileFactory(journalLocation, null);

      // Will use only default values. The load function should adapt to anything different
      ConfigurationImpl defaultValues = new ConfigurationImpl();

      JournalImpl messagesJournal = new JournalImpl(defaultValues.getJournalFileSize(),
                                                    defaultValues.getJournalMinFiles(),
                                                    0,
                                                    0,
                                                    messagesFF,
                                                    "hornetq-data",
                                                    "hq",
                                                    1);

      messagesJournal.start();

      ArrayList<RecordInfo> records = new ArrayList<RecordInfo>();
      ArrayList<PreparedTransactionInfo> txs = new ArrayList<PreparedTransactionInfo>();

      messagesJournal.load(records, txs, null, false);

      PageCursorsInfo cursorInfo = new PageCursorsInfo();


      for (RecordInfo record : records)
View Full Code Here

TOP

Related Classes of org.hornetq.core.journal.impl.JournalImpl$DummyLoader

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.