JournalStorageManager extends AbstractJournalStorageManager { protected int fixJournalFileSize(int fileSize, int alignment) { int size = fileSize; if (fileSize <= alignment) { size = alignment; } else { int modulus = fileSize % alignment; if (modulus != 0) { int difference = modulus; int low = fileSize - difference; int high = low + alignment; size = difference < alignment / 2 ? low : high; ActiveMQServerLogger.LOGGER.invalidJournalFileSize(fileSize, size, alignment); } } return size; } JournalStorageManager(final Configuration config,
                                final CriticalAnalyzer analyzer,
                                final ExecutorFactory executorFactory,
                                final ScheduledExecutorService scheduledExecutorService,
                                final ExecutorFactory ioExecutors);  JournalStorageManager(final Configuration config, CriticalAnalyzer analyzer, final ExecutorFactory executorFactory, final ExecutorFactory ioExecutors);  JournalStorageManager(final Configuration config,
                                final CriticalAnalyzer analyzer,
                                final ExecutorFactory executorFactory,
                                final ScheduledExecutorService scheduledExecutorService,
                                final ExecutorFactory ioExecutors,
                                final IOCriticalErrorListener criticalErrorListener);  JournalStorageManager(final Configuration config,
                                final CriticalAnalyzer analyzer,
                                final ExecutorFactory executorFactory,
                                final ExecutorFactory ioExecutors,
                                final IOCriticalErrorListener criticalErrorListener); @Override SequentialFileFactory getJournalSequentialFileFactory(); @Override void stop(); boolean isReplicated(); @Override void stop(boolean ioCriticalError, boolean sendFailover); @Override void pageClosed(final SimpleString storeName, final int pageNumber); @Override void pageDeleted(final SimpleString storeName, final int pageNumber); @Override void pageWrite(final PagedMessage message, final int pageNumber); @Override ByteBuffer allocateDirectBuffer(int size); @Override void freeDirectBuffer(ByteBuffer buffer); long storePendingLargeMessage(final long messageID); @Override void deleteLargeMessageBody(final LargeServerMessage largeServerMessage); @Override LargeServerMessage createLargeMessage(); @Override LargeServerMessage createLargeMessage(final long id, final Message message); @Override LargeServerMessage largeMessageCreated(long id, LargeServerMessage largeMessage); @Override SequentialFile createFileForLargeMessage(final long messageID, LargeMessageExtension extension); @Override void startReplication(ReplicationManager replicationManager,
                                PagingManager pagingManager,
                                String nodeID,
                                final boolean autoFailBack,
                                long initialReplicationSyncTimeout); @Override void stopReplication(); @Override final void addBytesToLargeMessage(final SequentialFile file,
                                            final long messageId,
                                            final ActiveMQBuffer bytes); @Override final void addBytesToLargeMessage(final SequentialFile file,
                                            final long messageId,
                                            final byte[] bytes); @Override void injectMonitor(FileStoreMonitor monitor);  }
@Test public void testFixJournalFileSize() throws Exception { if (journalType == JournalType.ASYNCIO) { assumeTrue("AIO is not supported on this platform", AIOSequentialFileFactory.isSupported()); } final Configuration configuration = createDefaultInVMConfig().setJournalType(journalType); final ExecutorFactory executorFactory = new OrderedExecutorFactory(executor); final ExecutorFactory ioExecutorFactory = new OrderedExecutorFactory(ioExecutor); final JournalStorageManager manager = new JournalStorageManager(configuration, null, executorFactory, null, ioExecutorFactory); Assert.assertEquals(4096, manager.fixJournalFileSize(1024, 4096)); Assert.assertEquals(4096, manager.fixJournalFileSize(4098, 4096)); Assert.assertEquals(8192, manager.fixJournalFileSize(8192, 4096)); }