jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r1212996 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/ xdocs/usermanual/functions.xml
Date Sun, 11 Dec 2011 12:07:55 GMT
Author: sebb
Date: Sun Dec 11 12:07:54 2011
New Revision: 1212996

Clarify docs (Bug 52284)


Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/ (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/ Sun Dec 11
12:07:54 2011
@@ -53,11 +53,15 @@ import org.apache.log.Logger;
  * Notes:
- * - JMeter instantiates a copy of each function for every reference in a
- * Sampler or elsewhere; each instance will open its own copy of the the file
- * - the file name is resolved at file (re-)open time
- * - the output variable name is resolved every time the function is invoked
- *
+ * <ul>
+ * <li>JMeter instantiates a single copy of each function for every reference in the
test plan</li>
+ * <li>Function instances are shared between threads.</li>
+ * <li>Each StringFromFile instance reads the file independently. The output variable
can be used to save the
+ * value for later use in the same thread.</li>
+ * <li>The file name is resolved at file (re-)open time; the file is initially opened
on first execution (which could be any thread)</li>
+ * <li>the output variable name is resolved every time the function is invoked</li>
+ * </ul>
+ * Because function instances are shared, it does not make sense to use the thread number
as part of the file name.
 public class StringFromFile extends AbstractFunction implements TestListener {
     private static final Logger log = LoggingManager.getLoggerForClass();

Modified: jmeter/trunk/xdocs/usermanual/functions.xml
--- jmeter/trunk/xdocs/usermanual/functions.xml (original)
+++ jmeter/trunk/xdocs/usermanual/functions.xml Sun Dec 11 12:07:54 2011
@@ -403,12 +403,18 @@ The reference name is now optional, but 
 	Each time it is called it reads the next line from the file.
+    All threads share the same instance, so different threads will get different lines.
 	When the end of the file is reached, it will start reading again from the beginning,
 	unless the maximum loop count has been reached.
 	If there are multiple references to the function in a test script, each will open the file
 	even if the file names are the same.
 	[If the value is to be used again elsewhere, use different variable names for each function
+    <note>
+    Function instances are shared between threads, and the file is (re-)opened by whatever
+    happens to need the next line of input, so using the threadNumber as part of the file
+    will result in unpredictable behaviour.
+    </note>
 	<p>If an error occurs opening or reading the file, then the function returns the string

View raw message