Java Code Examples for org.apache.activemq.artemis.core.config.Configuration#getJournalLocation()

The following examples show how to use org.apache.activemq.artemis.core.config.Configuration#getJournalLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActiveMQTestBase.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
/**
 * Reads a journal system and returns a Map<Integer,AtomicInteger> of recordTypes and the number of records per type,
 * independent of being deleted or not
 *
 * @param config
 * @return
 * @throws Exception
 */
protected HashMap<Integer, AtomicInteger> countJournal(Configuration config) throws Exception {
   final HashMap<Integer, AtomicInteger> recordsType = new HashMap<>();
   SequentialFileFactory messagesFF = new NIOSequentialFileFactory(config.getJournalLocation(), null, 1);

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

   for (JournalFile file : filesToRead) {
      JournalImpl.readJournalFile(messagesFF, file, new RecordTypeCounter(recordsType));
   }
   return recordsType;
}
 
Example 2
Source File: FailoverTestBase.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
/**
 * Override this if is needed a different implementation of {@link NodeManager} to be used into {@link #createReplicatedConfigs()}.
 */
protected NodeManager createReplicatedBackupNodeManager(Configuration backupConfig) {
   return new InVMNodeManager(true, backupConfig.getJournalLocation());
}
 
Example 3
Source File: ReplicaTimeoutTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
protected NodeManager createReplicatedBackupNodeManager(Configuration backupConfig) {
   return new InVMNodeManager(true, backupConfig.getJournalLocation());
}
 
Example 4
Source File: AmqpReplicatedTestSupport.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
/**
 * Override this if is needed a different implementation of {@link NodeManager} to be used into {@link #createReplicatedConfigs()}.
 */
protected NodeManager createReplicatedBackupNodeManager(Configuration backupConfig) {
   return new InVMNodeManager(true, backupConfig.getJournalLocation());
}
 
Example 5
Source File: JournalStorageManager.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
protected void init(Configuration config, IOCriticalErrorListener criticalErrorListener) {

   if (!EnumSet.allOf(JournalType.class).contains(config.getJournalType())) {
      throw ActiveMQMessageBundle.BUNDLE.invalidJournal();
   }

   bindingsFF = new NIOSequentialFileFactory(config.getBindingsLocation(), criticalErrorListener, config.getJournalMaxIO_NIO());
   bindingsFF.setDatasync(config.isJournalDatasync());

   Journal localBindings = new JournalImpl(ioExecutorFactory, 1024 * 1024, 2, config.getJournalPoolFiles(), config.getJournalCompactMinFiles(), config.getJournalCompactPercentage(), config.getJournalFileOpenTimeout(), bindingsFF, "activemq-bindings", "bindings", 1, 0, criticalErrorListener);

   bindingsJournal = localBindings;
   originalBindingsJournal = localBindings;

   switch (config.getJournalType()) {

      case NIO:
         if (criticalErrorListener != null) {
            ActiveMQServerLogger.LOGGER.journalUseNIO();
         }
         journalFF = new NIOSequentialFileFactory(config.getJournalLocation(), true, config.getJournalBufferSize_NIO(), config.getJournalBufferTimeout_NIO(), config.getJournalMaxIO_NIO(), config.isLogJournalWriteRate(), criticalErrorListener, getCriticalAnalyzer());
         break;
      case ASYNCIO:
         if (criticalErrorListener != null) {
            ActiveMQServerLogger.LOGGER.journalUseAIO();
         }
         journalFF = new AIOSequentialFileFactory(config.getJournalLocation(), config.getJournalBufferSize_AIO(), config.getJournalBufferTimeout_AIO(), config.getJournalMaxIO_AIO(), config.isLogJournalWriteRate(), criticalErrorListener, getCriticalAnalyzer());

         if (config.getJournalDeviceBlockSize() != null) {
            journalFF.setAlignment(config.getJournalDeviceBlockSize());
         }
         break;
      case MAPPED:
         if (criticalErrorListener != null) {
            ActiveMQServerLogger.LOGGER.journalUseMAPPED();
         }
         journalFF = new MappedSequentialFileFactory(config.getJournalLocation(), config.getJournalFileSize(), true, config.getJournalBufferSize_NIO(), config.getJournalBufferTimeout_NIO(), criticalErrorListener);
         break;
      default:
         throw ActiveMQMessageBundle.BUNDLE.invalidJournalType2(config.getJournalType());
   }

   journalFF.setDatasync(config.isJournalDatasync());


   int fileSize = fixJournalFileSize(config.getJournalFileSize(), journalFF.getAlignment());
   Journal localMessage = createMessageJournal(config, criticalErrorListener, fileSize);

   messageJournal = localMessage;
   originalMessageJournal = localMessage;

   largeMessagesDirectory = config.getLargeMessagesDirectory();

   largeMessagesFactory = new NIOSequentialFileFactory(config.getLargeMessagesLocation(), false, criticalErrorListener, 1);

   if (config.getPageMaxConcurrentIO() != 1) {
      pageMaxConcurrentIO = new Semaphore(config.getPageMaxConcurrentIO());
   } else {
      pageMaxConcurrentIO = null;
   }
}