Package org.hornetq.core.journal.impl

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


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

      SequentialFileFactory bindingsFF = new NIOSequentialFileFactory(bindingsDir, null);

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

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


      SequentialFileFactory messagesFF = new NIOSequentialFileFactory(messagesDir, 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",
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

      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

      SequentialFileFactory messagesFF = new NIOSequentialFileFactory(messagesDir);

      // 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",
View Full Code Here

      }

      server.stop();

     
      JournalImpl journal = new JournalImpl(server.getConfiguration().getJournalFileSize(),
                                            2,
                                            0,
                                            0,
                                            new NIOSequentialFileFactory(server.getConfiguration().getJournalDirectory()),
                                            "hornetq-data",
                                            "hq",
                                            1);
     
     
      final AtomicInteger updates = new AtomicInteger();
     
      journal.start();
      journal.load(new LoaderCallback()
      {
        
         public void failedTransaction(long transactionID, List<RecordInfo> records, List<RecordInfo> recordsToDelete)
         {
         }
        
         public void updateRecord(RecordInfo info)
         {
            if (info.userRecordType == JournalStorageManager.UPDATE_DELIVERY_COUNT)
            {
               updates.incrementAndGet();
            }
         }
        
         public void deleteRecord(long id)
         {
         }
        
         public void addRecord(RecordInfo info)
         {
         }
        
         public void addPreparedTransaction(PreparedTransactionInfo preparedTransaction)
         {
         }
      });
     
      journal.stop();
     
     
      assertEquals(7, updates.get());

   }
View Full Code Here

    * @return
    * @throws Exception
    */
   protected Pair<List<RecordInfo>, List<PreparedTransactionInfo>> loadMessageJournal(Configuration config) throws Exception
   {
      JournalImpl messagesJournal = null;
      try
      {
         SequentialFileFactory messagesFF = new NIOSequentialFileFactory(getJournalDir(), null);
  
         messagesJournal = new JournalImpl(config.getJournalFileSize(),
                                           config.getJournalMinFiles(),
                                           0,
                                           0,
                                           messagesFF,
                                           "hornetq-data",
                                           "hq",
                                           1);
         final List<RecordInfo> committedRecords = new LinkedList<RecordInfo>();
         final List<PreparedTransactionInfo> preparedTransactions = new LinkedList<PreparedTransactionInfo>();
        
         messagesJournal.start();
        
         messagesJournal.load(committedRecords, preparedTransactions, null, false);
        
         return new Pair<List<RecordInfo>, List<PreparedTransactionInfo>>(committedRecords, preparedTransactions);
      }
      finally
      {
         try
         {
            if (messagesJournal != null)
            {
               messagesJournal.stop();
            }
         }
         catch (Throwable ignored)
         {
         }
View Full Code Here

   protected HashMap<Integer, AtomicInteger> countJournal(Configuration config) throws Exception
   {
      final HashMap<Integer, AtomicInteger> recordsType = new HashMap<Integer, AtomicInteger>();
      SequentialFileFactory messagesFF = new NIOSequentialFileFactory(getJournalDir(), null);

      JournalImpl messagesJournal = new JournalImpl(config.getJournalFileSize(),
                                                    config.getJournalMinFiles(),
                                                    0,
                                                    0,
                                                    messagesFF,
                                                    "hornetq-data",
                                                    "hq",
                                                    1);
      List<JournalFile> filesToRead = messagesJournal.orderFiles();

      for (JournalFile file : filesToRead)
      {
         JournalImpl.readJournalFile(messagesFF, file, new JournalReaderCallback()
         {
View Full Code Here

   protected HashMap<Integer, AtomicInteger> countJournalLivingRecords(Configuration config) throws Exception
   {
      final HashMap<Integer, AtomicInteger> recordsType = new HashMap<Integer, AtomicInteger>();
      SequentialFileFactory messagesFF = new NIOSequentialFileFactory(getJournalDir(), null);

      JournalImpl messagesJournal = new JournalImpl(config.getJournalFileSize(),
                                                    config.getJournalMinFiles(),
                                                    0,
                                                    0,
                                                    messagesFF,
                                                    "hornetq-data",
                                                    "hq",
                                                    1);
      messagesJournal.start();
     
     
      final List<RecordInfo> committedRecords = new LinkedList<RecordInfo>();
      final List<PreparedTransactionInfo> preparedTransactions = new LinkedList<PreparedTransactionInfo>();
     
     
      messagesJournal.load(committedRecords, preparedTransactions, null, false);
     
      for (RecordInfo info: committedRecords)
      {
         Integer ikey = new Integer(info.getUserRecordType());
         AtomicInteger value = recordsType.get(ikey);
         if (value == null)
         {
            value = new AtomicInteger();
            recordsType.put(ikey, value);
         }
         value.incrementAndGet();
        
      }
     
      messagesJournal.stop();
      return recordsType;
   }
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.