jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1444543 - in /jmeter/trunk: src/core/org/apache/jmeter/control/LoopController.java xdocs/changes.xml
Date Sun, 10 Feb 2013 13:48:12 GMT
Author: pmouawad
Date: Sun Feb 10 13:48:11 2013
New Revision: 1444543

URL: http://svn.apache.org/r1444543
Log:
Bug 54467 - Loop controller Controller check conditions each request
Bugzilla Id: 54467

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java?rev=1444543&r1=1444542&r2=1444543&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java Sun Feb 10 13:48:11
2013
@@ -33,7 +33,7 @@ public class LoopController extends Gene
 
     private static final String LOOPS = "LoopController.loops"; // $NON-NLS-1$
 
-    private static final long serialVersionUID = 232L;
+    private static final long serialVersionUID = 7833960784370272300L;
 
     /*
      * In spite of the name, this is actually used to determine if the loop controller is
repeatable.
@@ -51,6 +51,9 @@ public class LoopController extends Gene
 
     private transient int loopCount = 0;
 
+    // Cache loop value, see Bug 54467
+    private Integer nbLoops;
+
     public LoopController() {
         setContinueForever_private(true);
     }
@@ -109,10 +112,20 @@ public class LoopController extends Gene
     }
 
     private boolean endOfLoop() {
-        final int loops = getLoops();
+        if(nbLoops==null) {
+            // Ensure we compute it only once per parent iteration, see Bug 54467
+            nbLoops = Integer.valueOf(getLoops());
+        }
+        final int loops = nbLoops.intValue();
         return (loops > -1) && (loopCount >= loops);
     }
 
+    @Override
+    protected void setDone(boolean done) {
+        nbLoops = null;
+        super.setDone(true);
+    }
+    
     /**
      * {@inheritDoc}
      */
@@ -145,6 +158,7 @@ public class LoopController extends Gene
 
     protected void resetLoopCount() {
         loopCount = 0;
+        nbLoops = null;
     }
 
     /**

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1444543&r1=1444542&r2=1444543&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Feb 10 13:48:11 2013
@@ -101,6 +101,7 @@ This does not affect JMeter operation.
 
 <h3>Controllers</h3>
 <ul>
+<li><bugzilla>54467</bugzilla> - Loop controller Controller check conditions
each request</li>
 </ul>
 
 <h3>Listeners</h3>



Mime
View raw message