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

The following examples show how to use org.apache.activemq.artemis.core.config.Configuration#getBindingsLocation() . 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: JMSJournalStorageManagerImpl.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
public JMSJournalStorageManagerImpl(ExecutorFactory ioExecutors,
                                    final IDGenerator idGenerator,
                                    final Configuration config,
                                    final ReplicationManager replicator) {
   final EnumSet<JournalType> supportedJournalTypes = EnumSet.allOf(JournalType.class);
   if (!supportedJournalTypes.contains(config.getJournalType())) {
      throw new IllegalArgumentException("Only " + supportedJournalTypes + " are supported Journal types");
   }

   this.config = config;

   createDir = config.isCreateBindingsDir();

   SequentialFileFactory bindingsJMS = new NIOSequentialFileFactory(config.getBindingsLocation(), 1);

   Journal localJMS = new JournalImpl(ioExecutors, 1024 * 1024, 2, config.getJournalPoolFiles(), config.getJournalCompactMinFiles(), config.getJournalCompactPercentage(), bindingsJMS, "activemq-jms", "jms", 1, 0);

   if (replicator != null) {
      jmsJournal = new ReplicatedJournal((byte) 2, localJMS, replicator);
   } else {
      jmsJournal = localJMS;
   }

   this.idGenerator = idGenerator;
}
 
Example 2
Source File: ActiveMQTestBase.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected HashMap<Integer, AtomicInteger> countBindingJournal(Configuration config) throws Exception {
   final HashMap<Integer, AtomicInteger> recordsType = new HashMap<>();
   SequentialFileFactory messagesFF = new NIOSequentialFileFactory(config.getBindingsLocation(), null, 1);

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

   for (JournalFile file : filesToRead) {
      JournalImpl.readJournalFile(messagesFF, file, new RecordTypeCounter(recordsType));
   }
   return recordsType;
}
 
Example 3
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;
   }
}