ARTEMIS-2853 page-max-concurrent-io cannot be disabled

This commit is contained in:
franz1981 2020-07-24 13:04:12 +02:00
parent 6e5025fe5e
commit f2d0d300f5
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.
*/