Java Code Examples for org.apache.activemq.artemis.core.config.Configuration#getJournalPoolFiles()
The following examples show how to use
org.apache.activemq.artemis.core.config.Configuration#getJournalPoolFiles() .
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 |
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 | 6 votes |
/** * 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 Pair<List<RecordInfo>, List<PreparedTransactionInfo>> loadMessageJournal(Configuration config) throws Exception { JournalImpl messagesJournal = null; try { SequentialFileFactory messagesFF = new NIOSequentialFileFactory(new File(getJournalDir()), null, 1); messagesJournal = new JournalImpl(config.getJournalFileSize(), config.getJournalMinFiles(), config.getJournalPoolFiles(), 0, 0, messagesFF, "activemq-data", "amq", 1); final List<RecordInfo> committedRecords = new LinkedList<>(); final List<PreparedTransactionInfo> preparedTransactions = new LinkedList<>(); messagesJournal.start(); messagesJournal.load(committedRecords, preparedTransactions, null, false); return new Pair<>(committedRecords, preparedTransactions); } finally { try { if (messagesJournal != null) { messagesJournal.stop(); } } catch (Throwable ignored) { } } }
Example 3
Source File: DescribeJournal.java From activemq-artemis with Apache License 2.0 | 5 votes |
public static DescribeJournal describeMessagesJournal(final File messagesDir, PrintStream out, boolean safe) throws Exception { Configuration configuration = getConfiguration(); SequentialFileFactory messagesFF = new NIOSequentialFileFactory(messagesDir, null, 1); // Will use only default values. The load function should adapt to anything different JournalImpl messagesJournal = new JournalImpl(configuration.getJournalFileSize(), configuration.getJournalMinFiles(), configuration.getJournalPoolFiles(), 0, 0, messagesFF, "activemq-data", "amq", 1); return describeJournal(messagesFF, messagesJournal, messagesDir, out, safe); }
Example 4
Source File: ActiveMQTestBase.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * 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 5
Source File: ActiveMQTestBase.java From activemq-artemis with Apache License 2.0 | 5 votes |
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 6
Source File: ShutdownOnCriticalIOErrorMoveNextTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
ActiveMQServer createServer(String folder) throws Exception { final AtomicBoolean blocked = new AtomicBoolean(false); Configuration conf = createConfig(folder); ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration()); conf.setPersistenceEnabled(true); ActiveMQServer server = new ActiveMQServerImpl(conf, securityManager) { @Override protected StorageManager createStorageManager() { JournalStorageManager storageManager = new JournalStorageManager(conf, getCriticalAnalyzer(), executorFactory, scheduledPool, ioExecutorFactory, shutdownOnCriticalIO) { @Override protected Journal createMessageJournal(Configuration config, IOCriticalErrorListener criticalErrorListener, int fileSize) { return new JournalImpl(ioExecutorFactory, fileSize, config.getJournalMinFiles(), config.getJournalPoolFiles(), config.getJournalCompactMinFiles(), config.getJournalCompactPercentage(), config.getJournalFileOpenTimeout(), journalFF, "activemq-data", "amq", journalFF.getMaxIO(), 0, criticalErrorListener) { @Override protected void moveNextFile(boolean scheduleReclaim) throws Exception { super.moveNextFile(scheduleReclaim); if (blocked.get()) { throw new IllegalStateException("forcibly down"); } } }; } @Override public void storeMessage(Message message) throws Exception { super.storeMessage(message); blocked.set(true); } }; this.getCriticalAnalyzer().add(storageManager); return storageManager; } }; return server; }
Example 7
Source File: JournalStorageManager.java From activemq-artemis with Apache License 2.0 | 4 votes |
@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; } }
Example 8
Source File: JournalStorageManager.java From activemq-artemis with Apache License 2.0 | 4 votes |
protected Journal createMessageJournal(Configuration config, IOCriticalErrorListener criticalErrorListener, int fileSize) { return new JournalImpl(ioExecutorFactory, fileSize, config.getJournalMinFiles(), config.getJournalPoolFiles(), config.getJournalCompactMinFiles(), config.getJournalCompactPercentage(), config.getJournalFileOpenTimeout(), journalFF, "activemq-data", "amq", journalFF.getMaxIO(), 0, criticalErrorListener); }