This commit is contained in:
Clebert Suconic 2020-07-24 13:23:55 -04:00
commit f46527b2e0
2 changed files with 16 additions and 1 deletions

View File

@ -176,7 +176,8 @@ public class JournalStorageManager extends AbstractJournalStorageManager {
largeMessagesFactory = new NIOSequentialFileFactory(config.getLargeMessagesLocation(), false, criticalErrorListener, 1);
if (config.getPageMaxConcurrentIO() != 1) {
// it doesn't make sense to limit paging concurrency < 0
if (config.getPageMaxConcurrentIO() >= 0) {
pageMaxConcurrentIO = new Semaphore(config.getPageMaxConcurrentIO());
} else {
pageMaxConcurrentIO = null;

View File

@ -91,6 +91,20 @@ public class JournalStorageManagerTest extends ActiveMQTestBase {
testExecutor.shutdownNow();
}
@Test
public void testDisablePageConcurrentMax() throws Exception {
if (journalType == JournalType.ASYNCIO) {
assumeTrue("AIO is not supported on this platform", AIOSequentialFileFactory.isSupported());
}
final Configuration configuration = createDefaultInVMConfig().setJournalType(journalType);
configuration.setPageMaxConcurrentIO(-1);
final ExecutorFactory executorFactory = new OrderedExecutorFactory(executor);
final ExecutorFactory ioExecutorFactory = new OrderedExecutorFactory(ioExecutor);
final JournalStorageManager manager = new JournalStorageManager(configuration, null, executorFactory, null, ioExecutorFactory);
// if -1 is being set it means that we should first call afterPageRead to acuire the permit to read a page
Assert.assertTrue(manager.beforePageRead(0, TimeUnit.NANOSECONDS));
}
/**
* Test of fixJournalFileSize method, of class JournalStorageManager.
*/