HI, all. The question is posted to SO here:
https://stackoverflow.com/questions/64991366/how-to-cleanly-close-embedded-activemq-artemis I'd like to add more details. This error is only detected on some computers only during JavaLite tests, and only recently. Nonetheless, it might expose an issue. It happens during execution of this test (others too): https://github.com/javalite/javalite/blob/java8/javalite-async/src/test/java/org/javalite/async/AsyncSpec.java As you can see, the broker starts and stops in the context of every test method. Within each test, we start a new broker, ensure that messages sent, accounted for, and then we stop the broker. Here is an example: This test sends 100 messages: https://github.com/javalite/javalite/blob/master/javalite-async/src/test/java/org/javalite/async/AsyncSpec.java#L101 This test sends 2 messages: https://github.com/javalite/javalite/blob/master/javalite-async/src/test/java/org/javalite/async/AsyncSpec.java#L148 They both fail due to the incorrect number of messages tested at the end. The 2 messages test fails because it receives 0 messages, and the 100 message test fails because it receives 102 messages. This is despite the fact that every test has a new broker located which uses a new temporary directory that is created anew at the start and deleted at the end of every test. This is not a problem with a real production since we do not expect multiple embedded brokers in the same JVM instance. Nonetheless, it might be an issue in Artemis that manifests itself like this. We are moving JavaLite to a new CI server, and this is a show stopper, as the build fails there with some random conditions (different tests fail randomly). Any tests executed individually by Maven on command line suceeds without issues, which makes me believe Artemis might leak some data in JVM across multiple instances. *Note*: if you want to follow JavaLite code, please ensure to look at the java8 branch, Any help is much appreciated. Igor