public void Start(int groupCount, ListenerNotifier notifier, OrderedHashTree threadGroupTree, StandardEngine engine) { int threadNumber = GetThreadsNumber(); // TODO : log Int32 now = System.DateTime.Now.Millisecond; NetMeterContext context = NetMeterContextManager.GetContext(); for (int i = 0; running && i < threadNumber; i++) { NetMeterThread nmThread = CreateThread(groupCount, notifier, threadGroupTree, engine, i, context); Thread newThread = new Thread(nmThread.Run); RegisterStartedThread(nmThread, newThread); newThread.Start(); } // TODO : log }
private void StartThreadGroup(AbstractThreadGroup group, int groupCount, SearchByType <AbstractThreadGroup> searcher, LinkedList <Object> testLevelElements, ListenerNotifier notifier) { int numThreads = group.GetNumThreads(); NetMeterContextManager.AddTotalThreads(numThreads); Boolean onErrorStopTest = group.GetOnErrorStopTest(); Boolean onErrorStopTestNow = group.GetOnErrorStopTestNow(); Boolean onErrorStopThread = group.GetOnErrorStopThread(); Boolean onErrorStartNextLoop = group.GetOnErrorStartNextLoop(); String groupName = group.GetName(); log.Info("Starting " + numThreads + " threads for group " + groupName + "."); if (onErrorStopTest) { log.Info("Test will stop on error"); } else if (onErrorStopTestNow) { log.Info("Test will stop abruptly on error"); } else if (onErrorStopThread) { log.Info("Thread will stop on error"); } else if (onErrorStartNextLoop) { log.Info("Thread will start next loop on error"); } else { log.Info("Thread will continue on error"); } OrderedHashTree threadGroupTree = (OrderedHashTree)searcher.GetSubTree(group); threadGroupTree.Put(group, testLevelElements); groups.Add(group); group.Start(groupCount, notifier, threadGroupTree, this); }
public abstract void Start(int groupCount, ListenerNotifier notifier, OrderedHashTree threadGroupTree, StandardEngine engine);
private NetMeterThread CreateThread(int groupCount, ListenerNotifier notifier, OrderedHashTree threadGroupTree, StandardEngine engine, int i, NetMeterContext context) { String groupName = GetName(); NetMeterThread nmThread = new NetMeterThread(CloneTree(threadGroupTree), this, notifier); nmThread.SetThreadNum(i); nmThread.SetThreadGroup(this); nmThread.SetInitialContext(context); String threadName = groupName + " " + (groupCount) + "-" + (i + 1); nmThread.SetThreadName(threadName); nmThread.SetEngine(engine); nmThread.SetOnErrorStopTest(GetOnErrorStopTest()); nmThread.SetOnErrorStopTestNow(GetOnErrorStopTestNow()); nmThread.SetOnErrorStopThread(GetOnErrorStopThread()); nmThread.SetOnErrorStartNextLoop(GetOnErrorStartNextLoop()); return(nmThread); }