This would be the wrong approach because it is not the controller's responsibility to call the sample method. Also, if you just want to end the loop, your controller should return false from the hasNext() method rather than returning true from the done() method. Being done technically means your controller will never have more samplers to deliver, which I assume you don't mean.
What you'll want is access to the latest sampleresult, in which case you can make your controller implement the SampleResultListener interface. And, in the very near future, there will be a JMeterContextService that will provide access to that type of thing. -Mike On 27 Feb 2003 at 20:49, Richard Han wrote: > Hi all, > > I would like to implement a loop controller that end the loop on error > condition. > This has been discussed on the list before for the issue of spider toolkit. > (see the message attached), > http://www.mail-archive.com/[EMAIL PROTECTED]/msg01206.html > > there, Mike suggested to extend the LoopController to end on error > condition. Could Mike or anyone give me some pointers on the implementation? > The obvious and most likely wrong approach I can think of is: > public class EndOnErrorLoopController extends > LoopController > { > public boolean isDone() > { > blar blar > Iterator iter = > subControllersAndSamplers.iterator(); > while (iter.hasNext()) > { > Object item = iter.next(); > if(item instanceof Sampler) > { > SampleResult result = > item.sample(true) ; > > if(!result.isSuccessful()) > { > return true; > } > } > } > } > But this approach does the sampling twice, one extra more than the normal > testing thead > > I just started to use JMeter and still in the early learning process, but I > am very impressed and I hope I could give some contributions. > > Thanks > > Richard > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Michael Stover [EMAIL PROTECTED] Yahoo IM: mstover_ya ICQ: 152975688 AIM: mstover777 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

