You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2013/02/10 14:48:12 UTC
svn commit: r1444543 - in /jmeter/trunk:
src/core/org/apache/jmeter/control/LoopController.java xdocs/changes.xml
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>
Re: svn commit: r1444543 - in /jmeter/trunk: src/core/org/apache/jmeter/control/LoopController.java
xdocs/changes.xml
Posted by sebb <se...@gmail.com>.
On 10 February 2013 13:48, <pm...@apache.org> wrote:
> 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;
Surely this should be transient, if loopCount is transient?
> +
> 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>
>
>