You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/03/03 19:35:16 UTC

svn commit: r1785363 - in /jmeter/trunk: src/core/org/apache/jmeter/threads/JMeterThread.java xdocs/changes.xml

Author: pmouawad
Date: Fri Mar  3 19:35:16 2017
New Revision: 1785363

URL: http://svn.apache.org/viewvc?rev=1785363&view=rev
Log:
Bug 60812 - JMeterThread does not honor contract of JMeterStopTestNowException
Bugzilla Id: 60812

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=1785363&r1=1785362&r2=1785363&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Fri Mar  3 19:35:16 2017
@@ -286,7 +286,7 @@ public class JMeterThread implements Run
             if (log.isInfoEnabled()) {
                 log.info("Stopping Test: {}", e.toString());
             }
-            stopTest();
+            shutdownTest();
         }
         catch (JMeterStopTestNowException e) { // NOSONAR
             if (log.isInfoEnabled()) {
@@ -433,7 +433,12 @@ public class JMeterThread implements Run
             if (log.isInfoEnabled()) {
                 log.info("Stopping Test: {}", e.toString());
             }
-            stopTest();
+            shutdownTest();
+        } catch (JMeterStopTestNowException e) { // NOSONAR
+            if (log.isInfoEnabled()) {
+                log.info("Stopping Test with interruption of current samplers: {}", e.toString());
+            }
+            stopTestNow();
         } catch (JMeterStopThreadException e) { // NOSONAR
             if (log.isInfoEnabled()) {
                 log.info("Stopping Thread: {}", e.toString());
@@ -525,7 +530,7 @@ public class JMeterThread implements Run
                 stopThread();
             }
             if (result.isStopTest() || (!result.isSuccessful() && onErrorStopTest)) {
-                stopTest();
+                shutdownTest();
             }
             if (result.isStopTestNow() || (!result.isSuccessful() && onErrorStopTestNow)) {
                 stopTestNow();
@@ -732,14 +737,20 @@ public class JMeterThread implements Run
         return false;
     }
 
-    private void stopTest() {
+    /**
+     * Clean shutdown of test, which means wait for end of current running samplers
+     */
+    private void shutdownTest() {
         running = false;
-        log.info("Stop Test detected by thread: {}", threadName);
+        log.info("Shutdown Test detected by thread: {}", threadName);
         if (engine != null) {
             engine.askThreadsToStop();
         }
     }
 
+    /**
+     * Stop test immediately by interrupting running samplers
+     */
     private void stopTestNow() {
         running = false;
         log.info("Stop Test Now detected by thread: {}", threadName);
@@ -748,6 +759,9 @@ public class JMeterThread implements Run
         }
     }
 
+    /**
+     * Clean Exit of current thread 
+     */
     private void stopThread() {
         running = false;
         log.info("Stop Thread detected by thread: {}", threadName);

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1785363&r1=1785362&r2=1785363&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Fri Mar  3 19:35:16 2017
@@ -334,6 +334,7 @@ This affects configuration and 3rd party
     <li><bug>60444</bug>Intermittent failure of <code>TestHTTPMirrorThread#testSleep()</code>. Contributed by Thomas Schapitz (ts-nospam12 at online.de)</li>
     <li><bug>60621</bug>The "<code>report-template</code>" folder is missing from <code>ApacheJMeter_config-3.1.jar</code> in maven central</li>
     <li><bug>60744</bug>GUI elements are not cleaned up when reused during load of Test Plan which can lead them to be partially initialized with a previous state for a new Test Element</li>
+    <li><bug>60812</bug>JMeterThread does not honor contract of JMeterStopTestNowException</li>
 </ul>
 
  <!--  =================== Thanks =================== -->