jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1212996 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/StringFromFile.java 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

URL: http://svn.apache.org/viewvc?rev=1212996&view=rev
Log:
Clarify docs (Bug 52284)

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java
    jmeter/trunk/xdocs/usermanual/functions.xml

Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java?rev=1212996&r1=1212995&r2=1212996&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java 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
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/functions.xml?rev=1212996&r1=1212995&r2=1212996&view=diff
==============================================================================
--- 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 
 
 	<p>
 	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
independently,
 	even if the file names are the same.
 	[If the value is to be used again elsewhere, use different variable names for each function
call.]
 	</p>
+    <note>
+    Function instances are shared between threads, and the file is (re-)opened by whatever
thread
+    happens to need the next line of input, so using the threadNumber as part of the file
name
+    will result in unpredictable behaviour.
+    </note>
 	<p>If an error occurs opening or reading the file, then the function returns the string
"**ERR**"</p>
 </description>
 



Mime
View raw message