}
ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
threadGroupTree.add(group, testLevelElements);
for (int i = 0; running && i < numThreads; i++) {
final JMeterThread jmeterThread = new JMeterThread(cloneTree(threadGroupTree), this, notifier);
jmeterThread.setThreadNum(i);
jmeterThread.setThreadGroup(group);
jmeterThread.setInitialContext(JMeterContextService.getContext());
jmeterThread.setInitialDelay((int) (perThreadDelay * i));
jmeterThread.setThreadName(groupName + " " + (groupCount) + "-" + (i + 1));
scheduleThread(jmeterThread, group);
// Set up variables for stop handling
jmeterThread.setEngine(this);
jmeterThread.setOnErrorStopTest(onErrorStopTest);
jmeterThread.setOnErrorStopThread(onErrorStopThread);
Thread newThread = new Thread(jmeterThread);
newThread.setName(jmeterThread.getThreadName());
allThreads.put(jmeterThread, newThread);
if (serialized && !iter.hasNext() && i == numThreads - 1) // last thread
{
serialized = false;
}