Author: milamber
Date: Sat Sep 17 15:03:52 2011
New Revision: 1171999

URL: http://svn.apache.org/viewvc?rev=1171999&view=rev
Log:
Bug 50032 - Fixed a new regression introduced by bug 50032 when Transaction 
Controller is a child of If Controller

Modified:
    
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java
    
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java?rev=1171999&r1=1171998&r2=1171999&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java 
(original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java 
Sat Sep 17 15:03:52 2011
@@ -228,6 +228,7 @@ public class GenericController extends A
      * 
      */
     protected void reInitializeSubController() {
+        boolean wasFlagSet = 
getThreadContext().setIsReinitializingSubControllers();
         try {
             TestElement currentElement = getCurrentElement();
             if (currentElement != null) {
@@ -240,6 +241,10 @@ public class GenericController extends A
                 }
             }
         } catch (NextIsNullException e) {
+        } finally {
+            if (wasFlagSet) {
+                getThreadContext().unsetIsReinitializingSubControllers();
+            }
         }
     }
     

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java?rev=1171999&r1=1171998&r2=1171999&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
 (original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
 Sat Sep 17 15:03:52 2011
@@ -192,7 +192,10 @@ public class TransactionController exten
                     // We must set res to null now, before sending the event 
for the transaction,
                     // so that we can ignore that event in our sampleOccured 
method
                     res = null;
-                    lnf.notifyListeners(event, pack.getSampleListeners());
+                    // bug 50032 
+                    if (!getThreadContext().isReinitializingSubControllers()) {
+                        lnf.notifyListeners(event, pack.getSampleListeners());
+                    }
                 }
             }
         }

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java?rev=1171999&r1=1171998&r2=1171999&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java 
Sat Sep 17 15:03:52 2011
@@ -49,6 +49,8 @@ public class JMeterContext {
 
     private byte[] readBuffer = null;
 
+    private boolean isReinitSubControllers = false;
+
     JMeterContext() {
         clear0();
     }
@@ -66,6 +68,7 @@ public class JMeterContext {
         threadNum = 0;
         readBuffer = null;
         thread = null;
+        isReinitSubControllers = false;
     }
 
     /**
@@ -169,4 +172,34 @@ public class JMeterContext {
     public void setSamplingStarted(boolean b) {
         samplingStarted = b;
     }
+
+    /**
+     * Reset flag indicating listeners should not be notified since reinit of 
sub 
+     * controllers is being done. See bug 50032 
+     */
+    public void unsetIsReinitializingSubControllers() {
+        if (isReinitSubControllers) {
+            isReinitSubControllers = false;
+        }
+    }
+
+    /**
+     * Set flag indicating listeners should not be notified since reinit of 
sub 
+     * controllers is being done. See bug 50032 
+     * @return true if it is the first one to set
+     */
+    public boolean setIsReinitializingSubControllers() {
+        if (!isReinitSubControllers) {
+            isReinitSubControllers = true;
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @return true if within reinit of Sub Controllers
+     */
+    public boolean isReinitializingSubControllers() {
+        return isReinitSubControllers;
+    }
 }

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1171999&r1=1171998&r2=1171999&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Sat Sep 17 15:03:52 2011
@@ -51,8 +51,6 @@ In particular, it can cause a NullPointe
 <p>Once Only controller behaves correctly under a Thread Group or Loop 
Controller,
 but otherwise its behaviour is not consistent (or clearly specified).</p>
 
-<p>If Controller generates additional samples for children Transaction 
Controller inside when condition is false.</p>
-
 <p>If Controller may make that JMeter starts a infinite running when the If 
condition is always
 false from the first iteration.</p>
 
@@ -92,7 +90,7 @@ This can be overridden by setting the JM
 
 <h3>Controllers</h3>
 <ul>
-<li>If Controller - Fixed a regression introduce by bug 50032 (see bug 50618 
too)</li>
+<li>If Controller - Fixed two regressions introduced by bug 50032 (see bug 
50618 too)</li>
 <li>If Controller - Catches a StackOverflowError when a condition returns 
always false (after at least one iteration with return true) See bug 50618</li>
 </ul>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@jakarta.apache.org
For additional commands, e-mail: notifications-h...@jakarta.apache.org

Reply via email to