Permalink
Browse files

Add flag forcing non-GUI JVM to exit after test

Bugzilla Id: 54669


git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1455289 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent e2f4367 commit fd86c36fcafa981e4652107221338e0da71275e3 @sebbASF sebbASF committed Mar 11, 2013
Showing with 16 additions and 0 deletions.
  1. +7 −0 bin/jmeter.properties
  2. +8 −0 src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
  3. +1 −0 xdocs/changes.xml
View
7 bin/jmeter.properties
@@ -832,9 +832,16 @@ beanshell.server.file=../extras/startup.bsh
#jmeterengine.remote.system.exit=false
# Whether to call System.exit(1) on failure to stop threads in non-GUI mode.
+# This only takes effect if the test was explictly requested to stop.
# If this is disabled, it may be necessary to kill the JVM externally
#jmeterengine.stopfail.system.exit=true
+# Whether to force call System.exit(0) at end of test in non-GUI mode, even if
+# there were no failures and the test was not explicitly asked to stop.
+# Without this, the JVM may never exit if there are other threads spawned by
+# the test which never exit.
+#jmeterengine.force.system.exit=false
+
# How long to pause (in ms) in the daemon thread before reporting that the JVM has failed to exit.
# If the value is <= 0, the JMeter does not start the daemon thread
#jmeter.exit.check.pause=2000
View
8 src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
@@ -86,6 +86,9 @@
/** Whether to call System.exit(1) if threads won't stop */
private static final boolean SYSTEM_EXIT_ON_STOP_FAIL = JMeterUtils.getPropDefault("jmeterengine.stopfail.system.exit", true);
+ /** Whether to call System.exit(0) unconditionally at end of non-GUI test */
+ private static final boolean SYSTEM_EXIT_FORCED = JMeterUtils.getPropDefault("jmeterengine.force.system.exit", false);
+
/** Flag to show whether test is running. Set to false to stop creating more threads. */
private volatile boolean running = false;
@@ -435,6 +438,11 @@ public void run() {
}
notifyTestListenersOfEnd(testListeners);
+
+ if (JMeter.isNonGUI() && SYSTEM_EXIT_FORCED) {
+ log.info("Forced JVM shutdown requested at end of test");
+ System.exit(0);
+ }
}
/**
View
1 xdocs/changes.xml
@@ -168,6 +168,7 @@ This does not affect JMeter operation.
<h3>General</h3>
<ul>
<li><bugzilla>54584</bugzilla> - MongoDB plugin</li>
+<li><bugzilla>54669</bugzilla> - Add flag forcing non-GUI JVM to exit after test</li>
</ul>
<h2>Non-functional changes</h2>

0 comments on commit fd86c36

Please sign in to comment.