Package org.hornetq.core.journal.impl

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


   {
      factory = new FakeSequentialFileFactory(512, true);

      try
      {
         journalImpl = new JournalImpl(2000, 2, 0, 0, factory, "tt", "tt", 1000);
         Assert.fail("Supposed to throw an exception");
      }
      catch (Exception ignored)
      {
      }
View Full Code Here


   public void testAlignmentOverReload() throws Exception
   {

      SequentialFileFactory factory = new FakeSequentialFileFactory(512, false);
      JournalImpl impl = new JournalImpl(512 + 512 * 3, 20, 0, 0, factory, "hq", "hq", 1000);

      impl.start();

      impl.load(AlignedJournalImplTest.dummyLoader);

      impl.appendAddRecord(1l, (byte)0, new SimpleEncoding(100, (byte)'a'), false);
      impl.appendAddRecord(2l, (byte)0, new SimpleEncoding(100, (byte)'b'), false);
      impl.appendAddRecord(3l, (byte)0, new SimpleEncoding(100, (byte)'b'), false);
      impl.appendAddRecord(4l, (byte)0, new SimpleEncoding(100, (byte)'b'), false);

      impl.stop();

      impl = new JournalImpl(512 + 1024 + 512, 20, 0, 0, factory, "hq", "hq", 1000);
      impl.start();
      impl.load(AlignedJournalImplTest.dummyLoader);

      // It looks silly, but this forceMoveNextFile is in place to replicate one
      // specific bug caught during development
      impl.forceMoveNextFile();

      impl.appendDeleteRecord(1l, false);
      impl.appendDeleteRecord(2l, false);
      impl.appendDeleteRecord(3l, false);
      impl.appendDeleteRecord(4l, false);

      impl.stop();

      impl = new JournalImpl(512 + 1024 + 512, 20, 0, 0, factory, "hq", "hq", 1000);
      impl.start();

      ArrayList<RecordInfo> info = new ArrayList<RecordInfo>();
      ArrayList<PreparedTransactionInfo> trans = new ArrayList<PreparedTransactionInfo>();

      impl.load(info, trans, null);

      Assert.assertEquals(0, info.size());
      Assert.assertEquals(0, trans.size());

   }
View Full Code Here

      if (journalImpl != null)
      {
         journalImpl.stop();
      }

      journalImpl = new JournalImpl(journalSize, numberOfMinimalFiles, 0, 0, factory, "tt", "tt", 1000);

      journalImpl.start();

      records.clear();
      transactions.clear();
View Full Code Here

      {
         factory = new NIOSequentialFileFactory(dir.getPath());
         maxAIO = ConfigurationImpl.DEFAULT_JOURNAL_MAX_IO_NIO;
      }

      journal = new JournalImpl(50 * 1024,
                                20,
                                15,
                                ConfigurationImpl.DEFAULT_JOURNAL_COMPACT_PERCENTAGE,
                                factory,
                                "hornetq-data",
View Full Code Here

   public void testParams() throws Exception
   {
      try
      {
         new JournalImpl(JournalImpl.MIN_FILE_SIZE - 1, 10, 0, 0, fileFactory, filePrefix, fileExtension, 1);

         Assert.fail("Should throw exception");
      }
      catch (IllegalArgumentException e)
      {
         // Ok
      }

      try
      {
         new JournalImpl(10 * 1024, 1, 0, 0, fileFactory, filePrefix, fileExtension, 1);

         Assert.fail("Should throw exception");
      }
      catch (IllegalArgumentException e)
      {
         // Ok
      }

      try
      {
         new JournalImpl(10 * 1024, 10, 0, 0, null, filePrefix, fileExtension, 1);

         Assert.fail("Should throw exception");
      }
      catch (NullPointerException e)
      {
         // Ok
      }

      try
      {
         new JournalImpl(10 * 1024, 10, 0, 0, fileFactory, null, fileExtension, 1);

         Assert.fail("Should throw exception");
      }
      catch (NullPointerException e)
      {
         // Ok
      }

      try
      {
         new JournalImpl(10 * 1024, 10, 0, 0, fileFactory, filePrefix, null, 1);

         Assert.fail("Should throw exception");
      }
      catch (NullPointerException e)
      {
         // Ok
      }

      try
      {
         new JournalImpl(10 * 1024, 10, 0, 0, fileFactory, filePrefix, null, 0);

         Assert.fail("Should throw exception");
      }
      catch (NullPointerException e)
      {
View Full Code Here

         internalTestProduceAndConsume();
         stopServer();

         NIOSequentialFileFactory factory = new NIOSequentialFileFactory(getJournalDir());
         JournalImpl journal = new JournalImpl(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE,
                                               2,
                                               0,
                                               0,
                                               factory,
                                               "hornetq-data",
                                               "hq",
                                               100);

         List<RecordInfo> committedRecords = new ArrayList<RecordInfo>();
         List<PreparedTransactionInfo> preparedTransactions = new ArrayList<PreparedTransactionInfo>();

         journal.start();
         journal.load(committedRecords, preparedTransactions, null);

         Assert.assertEquals(0, committedRecords.size());
         Assert.assertEquals(0, preparedTransactions.size());

         System.out.println("DataFiles = " + journal.getDataFilesCount());

         if (i % 2 == 0 && i > 0)
         {
            System.out.println("DataFiles = " + journal.getDataFilesCount());
            journal.forceMoveNextFile();
            if (journal.getDataFilesCount() != 0)
            {
               System.out.println("DebugJournal:"  + journal.debug());
            }
            Assert.assertEquals(0, journal.getDataFilesCount());
         }

         journal.stop();
         journal = null;

         setupServer(getJournalType());

      }
View Full Code Here

      maxAIO = 50;
   }

   public void createJournal() throws Exception
   {
      journal = new JournalImpl(fileSize, minFiles, 0, 0, fileFactory, filePrefix, fileExtension, maxAIO)
      {
         @Override
         public void onCompactDone()
         {
            latchDone.countDown();
View Full Code Here

   }

   @Override
   public void createJournal() throws Exception
   {
      journal = new JournalImpl(fileSize, minFiles, 0, 0, fileFactory, filePrefix, fileExtension, maxAIO)
      {

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

      journalDir = config.getJournalDirectory();

      SequentialFileFactory bindingsFF = new NIOSequentialFileFactory(bindingsDir);

      Journal localBindings = new JournalImpl(1024 * 1024,
                                              2,
                                              config.getJournalCompactMinFiles(),
                                              config.getJournalCompactPercentage(),
                                              bindingsFF,
                                              "hornetq-bindings",
                                              "bindings",
                                              1);

      if (replicator != null)
      {
         bindingsJournal = new ReplicatedJournal((byte)0, localBindings, replicator);
      }
      else
      {
         bindingsJournal = localBindings;
      }

      if (journalDir == null)
      {
         throw new NullPointerException("journal-dir is null");
      }

      createJournalDir = config.isCreateJournalDir();

      syncNonTransactional = config.isJournalSyncNonTransactional();

      syncTransactional = config.isJournalSyncTransactional();

      SequentialFileFactory journalFF = null;

      if (config.getJournalType() == JournalType.ASYNCIO)
      {
         JournalStorageManager.log.info("Using AIO Journal");

         journalFF = new AIOSequentialFileFactory(journalDir,
                                                  config.getJournalBufferSize_AIO(),
                                                  config.getJournalBufferTimeout_AIO(),
                                                  config.isLogJournalWriteRate());
      }
      else if (config.getJournalType() == JournalType.NIO)
      {
         JournalStorageManager.log.info("Using NIO Journal");
         journalFF = new NIOSequentialFileFactory(journalDir,
                                                  true,
                                                  config.getJournalBufferSize_NIO(),
                                                  config.getJournalBufferTimeout_NIO(),
                                                  config.isLogJournalWriteRate());
      }
      else
      {
         throw new IllegalArgumentException("Unsupported journal type " + config.getJournalType());
      }

      if (config.isBackup() && !config.isSharedStore())
      {
         idGenerator = null;
      }
      else
      {
         idGenerator = new BatchingIDGenerator(0, JournalStorageManager.CHECKPOINT_BATCH_SIZE, bindingsJournal);
      }
      Journal localMessage = new JournalImpl(config.getJournalFileSize(),
                                             config.getJournalMinFiles(),
                                             config.getJournalCompactMinFiles(),
                                             config.getJournalCompactPercentage(),
                                             journalFF,
                                             "hornetq-data",
View Full Code Here

   public static void describeBindingJournal(final String bindingsDir) throws Exception
   {

      SequentialFileFactory bindingsFF = new NIOSequentialFileFactory(bindingsDir);

      JournalImpl bindings = new JournalImpl(1024 * 1024, 2, -1, 0, bindingsFF, "hornetq-bindings", "bindings", 1);

      describeJournal(bindingsFF, bindings);
   }
View Full Code Here

TOP

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

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.