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

(-)src/core/org/apache/jmeter/threads/JMeterContext.java (+35 lines)
Lines 49-54 Link Here
49
49
50
    private boolean isReinitSubControllers = false;
50
    private boolean isReinitSubControllers = false;
51
51
52
    private boolean isWithinRestartNextLoop = false;
53
52
    JMeterContext() {
54
    JMeterContext() {
53
        clear0();
55
        clear0();
54
    }
56
    }
Lines 66-71 Link Here
66
        threadNum = 0;
68
        threadNum = 0;
67
        thread = null;
69
        thread = null;
68
        isReinitSubControllers = false;
70
        isReinitSubControllers = false;
71
        isWithinRestartNextLoop = false;
69
    }
72
    }
70
73
71
    /**
74
    /**
Lines 187-190 Link Here
187
    public boolean isReinitializingSubControllers() {
190
    public boolean isReinitializingSubControllers() {
188
        return isReinitSubControllers;
191
        return isReinitSubControllers;
189
    }
192
    }
193
194
    /**
195
     * unset flag indicating that JMeterThread has met an error.
196
     * And is restarting next loop, for example IfController 
197
     * should not evaluate Condition, See bug 50032 
198
     */
199
    public void unsetIsWithinRestartNextLoop() {
200
        if (isWithinRestartNextLoop) {
201
            isWithinRestartNextLoop = false;
202
        }
203
    }
204
    
205
    /**
206
     * @return true if JMeterThread is restarting next loop
207
     */
208
    public boolean isWithinRestartNextLoop() {
209
        return isWithinRestartNextLoop;
210
    }
211
    
212
    /**
213
     * Set flag indicating that JMeterThread has met an error.
214
     * And is restarting next loop, for example IfController 
215
     * should not evaluate Condition, See bug 50032 
216
     * @return true if it is the first one to set
217
     */
218
    public boolean setIsWithinRestartNextLoop() {
219
        if (!isWithinRestartNextLoop) {
220
            isWithinRestartNextLoop = true;
221
            return true;
222
        }
223
        return false;
224
    }
190
}
225
}
(-)src/core/org/apache/jmeter/threads/JMeterThread.java (-6 / +11 lines)
Lines 285-297 Link Here
285
                            process_sampler(sam, null, threadContext);
285
                            process_sampler(sam, null, threadContext);
286
                            sam = controller.next();
286
                            sam = controller.next();
287
                        } else {
287
                        } else {
288
                            // Last not ok. start get the begining of the tree
288
                            try{
289
                            sam = controller.next(); // need perfom a until loop for special case (tc as parent)
289
                                JMeterContextService.getContext().setIsWithinRestartNextLoop();
290
                            while (sam != null && !sam.equals(firstSampler)) { // while the thread is NOT on the begining of the tree
290
                                // Last not ok. start get the begining of the tree
291
                                sam = controller.next();
291
                                sam = controller.next(); // need perfom a until loop for special case (tc as parent)
292
                                while (sam != null && !sam.equals(firstSampler)) { // while the thread is NOT on the begining of the tree
293
                                    sam = controller.next();
294
                                }
295
                                // At this point: begining tree, thus Last must Ok
296
                                threadContext.getVariables().put(LAST_SAMPLE_OK, TRUE);
297
                            } finally {
298
                                JMeterContextService.getContext().unsetIsWithinRestartNextLoop();                                
292
                            }
299
                            }
293
                            // At this point: begining tree, thus Last must Ok
294
                            threadContext.getVariables().put(LAST_SAMPLE_OK, TRUE);
295
                        }
300
                        }
296
                    } else {
301
                    } else {
297
                        process_sampler(sam, null, threadContext);
302
                        process_sampler(sam, null, threadContext);
(-)src/components/org/apache/jmeter/modifiers/CounterConfig.java (+4 lines)
Lines 81-86 Link Here
81
    public synchronized void iterationStart(LoopIterationEvent event) {
81
    public synchronized void iterationStart(LoopIterationEvent event) {
82
        // Cannot use getThreadContext() as not cloned per thread
82
        // Cannot use getThreadContext() as not cloned per thread
83
        JMeterVariables variables = JMeterContextService.getContext().getVariables();
83
        JMeterVariables variables = JMeterContextService.getContext().getVariables();
84
        if(JMeterContextService.getContext().isWithinRestartNextLoop())
85
        {
86
            return;
87
        }
84
        long start = getStart(), end = getEnd(), increment = getIncrement();
88
        long start = getStart(), end = getEnd(), increment = getIncrement();
85
        if (!isPerUser()) {
89
        if (!isPerUser()) {
86
            if (globalCounter == Long.MIN_VALUE || globalCounter > end) {
90
            if (globalCounter == Long.MIN_VALUE || globalCounter > end) {

Return to bug 51866