You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/10/12 01:13:24 UTC

svn commit: r463046 - /jakarta/jmeter/branches/rel-2-2/src/functions/org/apache/jmeter/functions/IterationCounter.java

Author: sebb
Date: Wed Oct 11 16:13:24 2006
New Revision: 463046

URL: http://svn.apache.org/viewvc?view=rev&rev=463046
Log:
Fix deserialisation bug

Modified:
    jakarta/jmeter/branches/rel-2-2/src/functions/org/apache/jmeter/functions/IterationCounter.java

Modified: jakarta/jmeter/branches/rel-2-2/src/functions/org/apache/jmeter/functions/IterationCounter.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/functions/org/apache/jmeter/functions/IterationCounter.java?view=diff&rev=463046&r1=463045&r2=463046
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/src/functions/org/apache/jmeter/functions/IterationCounter.java (original)
+++ jakarta/jmeter/branches/rel-2-2/src/functions/org/apache/jmeter/functions/IterationCounter.java Wed Oct 11 16:13:24 2006
@@ -34,13 +34,17 @@
 
 	private static final String KEY = "__counter";
 
-    private transient ThreadLocal perThreadInt = new ThreadLocal(){
-        protected synchronized Object initialValue() {
-            return new Integer(0);
-        }
-    };
+    private transient ThreadLocal perThreadInt;
     
-	static {
+	private void init(){
+        perThreadInt = new ThreadLocal(){
+            protected synchronized Object initialValue() {
+                return new Integer(0);
+            };
+        };
+    }
+        
+    static {
 		desc.add(JMeterUtils.getResString("iteration_counter_arg_1")); //$NON-NLS-1$
 		desc.add(JMeterUtils.getResString("function_name_param")); //$NON-NLS-1$
 	}
@@ -50,9 +54,16 @@
 	transient private int globalCounter;//MAXINT = 2,147,483,647
 
 	public IterationCounter() {
+        init();
         globalCounter=0;
     }
 
+    private Object readResolve(){
+        init();
+        globalCounter=0;
+        return this;
+    }
+    
 	public Object clone() {
 		IterationCounter newCounter = new IterationCounter();
 		newCounter.globalCounter = globalCounter;



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org