diff --git a/bin/testfiles/JMS_TESTS.jmx b/bin/testfiles/JMS_TESTS.jmx
index 47796fd0244..ad50947eabe 100644
--- a/bin/testfiles/JMS_TESTS.jmx
+++ b/bin/testfiles/JMS_TESTS.jmx
@@ -1389,10 +1389,6 @@ propFloat 1.2
-
- 5100
-
-
groovy
@@ -1403,9 +1399,15 @@ import org.apache.jmeter.util.JMeterUtils;
import org.apache.commons.io.FileUtils;
BrokerService broker = props.get("ACTIVEMQ_BROKER");
-broker.stop();
-
-FileUtils.deleteDirectory(new File(JMeterUtils.getJMeterHome(), "bin/activemq-data"));
+Thread.start {
+ // The delay is to allow for JMS Publishers to close resources in testEnded event
+ // Note: JMeter warns for non-daemon threads which are active
+ // So the sleep duration should be less than 2sec
+ // Otherwise "The following non-daemon threads are still running" is printed
+ sleep(700)
+ broker.stop()
+ FileUtils.deleteDirectory(new File(JMeterUtils.getJMeterHome(), "bin/activemq-data"))
+}