sebb 2004/06/19 17:53:16
Modified: src/components/org/apache/jmeter/modifiers Tag: rel-2_0
UserParameters.java
Log:
Comments describing lock field
Revision Changes Path
No revision
No revision
1.22.2.1 +19 -11
jakarta-jmeter/src/components/org/apache/jmeter/modifiers/UserParameters.java
Index: UserParameters.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/components/org/apache/jmeter/modifiers/UserParameters.java,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -u -r1.22 -r1.22.2.1
--- UserParameters.java 22 Feb 2004 19:17:45 -0000 1.22
+++ UserParameters.java 20 Jun 2004 00:53:16 -0000 1.22.2.1
@@ -46,6 +46,15 @@
public static final String NAMES = "UserParameters.names";
public static final String THREAD_VALUES = "UserParameters.thread_values";
public static final String PER_ITERATION = "UserParameters.per_iteration";
+
+ /*
+ * Although the lock appears to be an instance lock, in fact
+ * the lock is shared between all threads in a thread group, but different
+ * thread groups have different locks - see the clone() method below
+ *
+ * The lock ensures that all the variables are processed together, which is
+ * important for functions such as __CSVRead and _StringFromFile.
+ */
private Integer lock = new Integer(0);
public CollectionProperty getNames()
@@ -177,21 +186,20 @@
}
}
- /* This method doesn't appear to be used anymore.
- * [EMAIL PROTECTED] 03 May 2003
- *
- * @see ThreadListener#setJMeterVariables(JMeterVariables)
- public void setJMeterVariables(JMeterVariables jmVars)
- {}
- */
-
/* (non-Javadoc)
+ * A new instance is created for each thread group, and the
+ * clone() method is then called to create copies for each thread
+ * in a thread group.
+ * This means that the lock object is common to a thread group;
+ * separate thread groups have separate locks.
+ * If this is not intended, the lock object could be made static.
+ *
* @see java.lang.Object#clone()
*/
public Object clone()
{
UserParameters up = (UserParameters) super.clone();
- up.lock = lock;
+ up.lock = lock; // ensure that clones share the same lock object
return up;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]