brusdev commented on a change in pull request #2741: ARTEMIS-2415 JDBCJournal
miss pending tasks during shutdown
URL: https://github.com/apache/activemq-artemis/pull/2741#discussion_r305574631
##########
File path:
artemis-server/src/test/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManagerTest.java
##########
@@ -212,4 +212,36 @@ public void
testAddBytesToLargeMessageNotLeakingByteBuffer() throws Exception {
}
}
+ @Test
+ public void testDeletingLargeMessagePendingTasksOnShutdown() 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);
+ manager.start();
+ manager.loadBindingJournal(new ArrayList<>(), new ArrayList<>(), new
ArrayList<>());
+ final PostOffice postOffice = mock(PostOffice.class);
+ final JournalLoader journalLoader = mock(JournalLoader.class);
+ manager.loadMessageJournal(postOffice, null, null, null, null, null,
null, journalLoader);
+ final LargeServerMessage largeMessage =
manager.createLargeMessage(manager.generateID() + 1, new
CoreMessage().setDurable(true));
+ final SequentialFile file = largeMessage.getFile();
+ manager.getContext(true).storeLineUp();
+ manager.deleteLargeMessageFile(largeMessage);
+ final CountDownLatch latch = new CountDownLatch(1);
+ Executors.newSingleThreadExecutor().execute(() -> {
+ try {
+ manager.stop();
+ latch.countDown();
+ } catch (Exception ignore) {
+ }
+ });
+ Thread.sleep(500);
Review comment:
I replaced the sleep with a latch and a wait.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services