Author: pmouawad Date: Thu Nov 2 22:44:12 2017 New Revision: 1814121 URL: http://svn.apache.org/viewvc?rev=1814121&view=rev Log: Bug 61709 - SampleResult : Add a method setIgnore() to make JMeter ignore the SampleResult and not send it to listeners Bugzilla Id: 61709
Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java jmeter/trunk/xdocs/changes.xml jmeter/trunk/xdocs/usermanual/component_reference.xml Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=1814121&r1=1814120&r2=1814121&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java Thu Nov 2 22:44:12 2017 @@ -275,6 +275,8 @@ public class SampleResult implements Ser private URL location; + private transient boolean ignore; + /** * Cache for responseData as string to avoid multiple computations */ @@ -1520,4 +1522,18 @@ public class SampleResult implements Ser datasToSearch.add(getResponseHeaders()); return datasToSearch; } + + /** + * @return boolean true if this SampleResult should not be sent to Listeners + */ + public boolean isIgnore() { + return ignore; + } + + /** + * Call this method to tell JMeter to ignore this SampleResult by Listeners + */ + public void setIgnore() { + this.ignore = true; + } } 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=1814121&r1=1814120&r2=1814121&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Thu Nov 2 22:44:12 2017 @@ -506,7 +506,7 @@ public class JMeterThread implements Run currentSampler = null; } // If we got any results, then perform processing on the result - if (result != null) { + if (result != null && !result.isIgnore()) { int nbActiveThreadsInThreadGroup = threadGroup.getNumberOfThreads(); int nbTotalActiveThreads = JMeterContextService.getNumberOfThreads(); result.setGroupThreads(nbActiveThreadsInThreadGroup); Modified: jmeter/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1814121&r1=1814120&r2=1814121&view=diff ============================================================================== --- jmeter/trunk/xdocs/changes.xml [utf-8] (original) +++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Nov 2 22:44:12 2017 @@ -133,6 +133,7 @@ Summary <ul> <li><bug>61549</bug>Thread Group : Remove start and end date</li> <li><bug>61529</bug>Migration to Java 9. Partly contributed by Ubik Load Pack (support at ubikloadpack.com)</li> + <li><bug>61709</bug>SampleResult : Add a method <code>setIgnore()</code> to make JMeter ignore the SampleResult and not send it to listeners</li> <li><bug>61607</bug>Add browse button in all beanshell elements to select beanshell script</li> <li><bug>61627</bug>Don't clear LogView anymore when clicking on Warning/Errors Indicator</li> <li><bug>61629</bug>Add Think Times to Children menu should not consider disabled elements</li> Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1814121&r1=1814120&r2=1814121&view=diff ============================================================================== --- jmeter/trunk/xdocs/usermanual/component_reference.xml (original) +++ jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Nov 2 22:44:12 2017 @@ -1199,7 +1199,11 @@ Currently the only way to change these i <component name="JSR223 Sampler" index="§-num;.1.11.1" width="861" height="502" screenshot="jsr223-sampler.png"> <description> <p> -The JSR223 Sampler allows JSR223 script code to be used to perform a sample. +The JSR223 Sampler allows JSR223 script code to be used to perform a sample or some computation required to create/update variables. +<note> +If you don't want to generate a <a href="../api/org/apache/jmeter/samplers/SampleResult.html">SampleResult</a> when this sampler is run, call the following method: +<source>SampleResult.setIgnore();</source> +</note> </p> <p> The JSR223 test elements have a feature (compilation) that can significantly increase performance.