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 2015/12/19 11:33:00 UTC

svn commit: r1720893 - in /jmeter/trunk: bin/jmeter.properties src/core/org/apache/jmeter/threads/JMeterThread.java

Author: pmouawad
Date: Sat Dec 19 10:33:00 2015
New Revision: 1720893

URL: http://svn.apache.org/viewvc?rev=1720893&view=rev
Log:
Bug 58736 - Add Sample Timeout support
Ensure sampleEnded is called
Drop property  JMeterThread.sampleStarted, users who don't want to use the feature won't add the Sample Timeout element
Bugzilla Id: 58736

Modified:
    jmeter/trunk/bin/jmeter.properties
    jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java

Modified: jmeter/trunk/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.properties?rev=1720893&r1=1720892&r2=1720893&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter.properties (original)
+++ jmeter/trunk/bin/jmeter.properties Sat Dec 19 10:33:00 2015
@@ -1030,11 +1030,6 @@ beanshell.server.file=../extras/startup.
 # If you want to use Nashorn on JDK8, set this property to false
 #javascript.use_rhino=true
 
-# (2.14) JMeterThread behaviour has changed: it now implements sampleStarted/sampleStopped
-# This is necessary for the test element Sample Timeout
-# Uncomment the following line to revert to the original behaviour (Sample Timeout will no longer work)
-#JMeterThread.sampleStarted=false
-
 # Number of milliseconds to wait for a thread to stop
 #jmeterengine.threadstop.wait=5000
 

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=1720893&r1=1720892&r2=1720893&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Sat Dec 19 10:33:00 2015
@@ -149,13 +149,9 @@ public class JMeterThread implements Run
         SearchByClass<TestIterationListener> threadListenerSearcher = new SearchByClass<>(TestIterationListener.class); // TL - IS
         test.traverse(threadListenerSearcher);
         testIterationStartListeners = threadListenerSearcher.getSearchResults();
-        if (IMPLEMENTS_SAMPLE_STARTED) {
-            SearchByClass<SampleMonitor> sampleMonitorSearcher = new SearchByClass<>(SampleMonitor.class);
-            test.traverse(sampleMonitorSearcher);
-            sampleMonitors = sampleMonitorSearcher.getSearchResults();
-        } else {
-            sampleMonitors = null;
-        }
+        SearchByClass<SampleMonitor> sampleMonitorSearcher = new SearchByClass<>(SampleMonitor.class);
+        test.traverse(sampleMonitorSearcher);
+        sampleMonitors = sampleMonitorSearcher.getSearchResults();
         notifier = note;
         running = true;
     }
@@ -447,16 +443,16 @@ public class JMeterThread implements Run
 
         // Perform the actual sample
         currentSampler = sampler;
-        if (IMPLEMENTS_SAMPLE_STARTED) {
-            for(SampleMonitor monitor : sampleMonitors) {
-                monitor.sampleStarting();
-            }                    
+        for(SampleMonitor monitor : sampleMonitors) {
+            monitor.sampleStarting();
         }
-        SampleResult result = sampler.sample(null); // TODO: remove this useless Entry parameter
-        if (IMPLEMENTS_SAMPLE_STARTED) {
+        SampleResult result = null;
+        try {
+            result = sampler.sample(null); // TODO: remove this useless Entry parameter
+        } finally {
             for(SampleMonitor monitor : sampleMonitors) {
                 monitor.sampleEnded();
-            }                    
+            }            
         }
         currentSampler = null;