int lcLoops = 0;
boolean lcContinueForever = false;
running = true;
JMeterThread jMeterThread;
Iterator iter = threadGroups.iterator();
ThreadGroup thisThreadGroup = null;
boolean runThis = false;
while(iter.hasNext())
{
// look for threadGroup with MethodConfig element
thisThreadGroup = (ThreadGroup)iter.next();
GenericController control = (GenericController)
thisThreadGroup.getSamplerController().clone();
List subControllerList = control.getSubControllers();
List configElementList = control.getConfigElements();
Iterator subControllersIterator = subControllerList.iterator();
if(catClass.isDebugEnabled())
{
catClass.debug("runTest1 : thisThreadGroup - " + thisThreadGroup);
catClass.debug("runTest1 : controller - " + control);
catClass.debug("runTest1 : configElementList - " + configElementList);
catClass.debug("runTest1 : subControllerList - " + subControllerList);
}
while(subControllersIterator.hasNext())
{
SamplerController samplerController = (SamplerController)
subControllersIterator.next();
if(catClass.isDebugEnabled())
{
catClass.debug("runTest1 : samplerController type - "
+ samplerController.getClass());
}
if(samplerController instanceof JndiTestSample)
{
runThis = true;
}
}
if(runThis)
{
catClass.debug("runTest1 : running ThreadGroup with JndiTestSample");
// Change the ThreadGroup looping to 1 'cos you only need to
// run the JNDISampler once to do reflection
// Ensure that sampleController of ThreadGroup is a LoopController
// which is a certainty but still in case things change in the future
// this should flag it
LoopController lc = null;
if(control instanceof LoopController)
{
lc = (LoopController)control;
lcLoops = lc.getLoops();
lcContinueForever = lc.getContinueForever();
lc.setContinueForever(false);
lc.setLoops(1);
thisThreadGroup.setSamplerController(lc);
}
runThis = false;
jMeterThread = new JMeterThread(thisThreadGroup);
Thread newThread = new Thread(jMeterThread);
newThread.start();
try
{
newThread.join();
}
catch(InterruptedException e)
{
catClass.error(e);
System.out.println(e);
}
lc.setContinueForever(lcContinueForever);
lc.setLoops(lcLoops);
thisThreadGroup.setSamplerController(lc);
}
}
catClass.debug("End : runTest1");
}