schcdule_run = true;
JMeterContextService.getContext().setSamplingStarted(true);
int groupCount = 1;
while (iter.hasNext())
{
ThreadGroup group = (ThreadGroup) iter.next();
threads = new JMeterThread[group.getNumThreads()];
log.info("Starting " + threads.length + " test threads");
for (int i = 0; running && i < threads.length; i++)
{
ListedHashTree threadGroupTree =
(ListedHashTree) searcher.getSubTree(group);
threadGroupTree.add(group, testLevelElements);
threads[i] =
new JMeterThread(
cloneTree(threadGroupTree),
this,
notifier);
threads[i].setThreadNum(i);
threads[i].setInitialContext(JMeterContextService.getContext());
threads[i].setInitialDelay(
(int) (((float) (group.getRampUp() * 1000)
/ (float) group.getNumThreads())
* (float) i));
threads[i].setThreadName(group.getName() + (groupCount++) + "-" + (i + 1));
scheduleThread(threads[i], group);
Thread newThread = new Thread(threads[i]);
newThread.setName(threads[i].getThreadName());