View | Details | Raw Unified | Return to bug 50032
Collapse All | Expand All

(-)src/core/org/apache/jmeter/threads/JMeterContext.java (+46 lines)
Lines 21-26 Link Here
21
import org.apache.jmeter.samplers.SampleResult;
21
import org.apache.jmeter.samplers.SampleResult;
22
import org.apache.jmeter.samplers.Sampler;
22
import org.apache.jmeter.samplers.Sampler;
23
import org.apache.jmeter.engine.StandardJMeterEngine;
23
import org.apache.jmeter.engine.StandardJMeterEngine;
24
import org.apache.jorphan.logging.LoggingManager;
25
import org.apache.log.Logger;
24
26
25
/**
27
/**
26
 * Holds context for a thread.
28
 * Holds context for a thread.
Lines 29-34 Link Here
29
 * The class is not thread-safe - it is only intended for use within a single thread.
31
 * The class is not thread-safe - it is only intended for use within a single thread.
30
 */
32
 */
31
public class JMeterContext {
33
public class JMeterContext {
34
    private static final Logger log = LoggingManager.getLoggerForClass();
35
    
32
    private JMeterVariables variables;
36
    private JMeterVariables variables;
33
37
34
    private SampleResult previousResult;
38
    private SampleResult previousResult;
Lines 49-54 Link Here
49
53
50
    private byte[] readBuffer = null;
54
    private byte[] readBuffer = null;
51
55
56
    private boolean isReinitializingSubControllers = false;
57
52
    JMeterContext() {
58
    JMeterContext() {
53
        clear0();
59
        clear0();
54
    }
60
    }
Lines 66-71 Link Here
66
        threadNum = 0;
72
        threadNum = 0;
67
        readBuffer = null;
73
        readBuffer = null;
68
        thread = null;
74
        thread = null;
75
        isReinitializingSubControllers = false;
69
    }
76
    }
70
77
71
    /**
78
    /**
Lines 169-172 Link Here
169
    public void setSamplingStarted(boolean b) {
176
    public void setSamplingStarted(boolean b) {
170
        samplingStarted = b;
177
        samplingStarted = b;
171
    }
178
    }
179
180
    /**
181
     * Reset flag indicating listeners should not be notified since reinit of sub 
182
     * controllers is being done
183
     * @see ISSUE 50032 
184
     */
185
    public void unsetIsReinitializingSubControllers() {
186
        if(isReinitializingSubControllers)
187
        {
188
            isReinitializingSubControllers = false;
189
        }
190
        else
191
        {
192
            log.warn("Unsetting while flag is not true");
193
        }
194
    }
195
196
    /**
197
     * Set flag indicating listeners should not be notified since reinit of sub 
198
     * controllers is being done
199
     * @return true if it is the first one to set
200
     * @see ISSUE 50032 
201
     */
202
    public boolean setIsReinitializingSubControllers() {
203
        if(!isReinitializingSubControllers)
204
        {
205
            isReinitializingSubControllers = true;
206
            return true;
207
        }
208
        return false;
209
    }
210
211
    /**
212
     * @return true if within reinit of Sub Controllers
213
     * @see ISSUE 50032 
214
     */
215
    public boolean isReinitializingSubControllers() {
216
        return isReinitializingSubControllers;
217
    }
172
}
218
}
(-)src/core/org/apache/jmeter/control/GenericController.java (+7 lines)
Lines 228-233 Link Here
228
     * 
228
     * 
229
     */
229
     */
230
    protected void reInitializeSubController() {
230
    protected void reInitializeSubController() {
231
        boolean wasFlagSet = getThreadContext().setIsReinitializingSubControllers();
231
        try {
232
        try {
232
            TestElement currentElement = getCurrentElement();
233
            TestElement currentElement = getCurrentElement();
233
            if (currentElement != null) {
234
            if (currentElement != null) {
Lines 241-246 Link Here
241
            }
242
            }
242
        } catch (NextIsNullException e) {
243
        } catch (NextIsNullException e) {
243
        }
244
        }
245
        finally
246
        {
247
            if(wasFlagSet) {                
248
                getThreadContext().unsetIsReinitializingSubControllers();
249
            }
250
        }
244
    }
251
    }
245
    
252
    
246
    /**
253
    /**
(-)src/core/org/apache/jmeter/control/TransactionController.java (-1 / +5 lines)
Lines 192-198 Link Here
192
                    // We must set res to null now, before sending the event for the transaction,
192
                    // We must set res to null now, before sending the event for the transaction,
193
                    // so that we can ignore that event in our sampleOccured method
193
                    // so that we can ignore that event in our sampleOccured method
194
                    res = null;
194
                    res = null;
195
                    lnf.notifyListeners(event, pack.getSampleListeners());
195
                    // RELATED TO ISSUE 50032 
196
                    if(!getThreadContext().isReinitializingSubControllers())
197
                    {
198
                        lnf.notifyListeners(event, pack.getSampleListeners());
199
                    }
196
                }
200
                }
197
            }
201
            }
198
        }
202
        }

Return to bug 50032