Examples of JMeterThread


Examples of org.apache.jmeter.threads.JMeterThread

    private void stopAllThreads() {
        synchronized (allThreads) {// Protect iterator
            Iterator<JMeterThread> iter = new HashSet<JMeterThread>(allThreads.keySet()).iterator();
            while (iter.hasNext()) {
                JMeterThread item = iter.next();
                item.stop(); // This is quick
            }
        }
    }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

    private static boolean stopThread(String threadName, boolean now) {
        if (engine == null) {
            return false;// e.g. not yet started
        }
        JMeterThread thrd=null;
        synchronized (engine.allThreads) { // Protect iterator
            Iterator iter = engine.allThreads.keySet().iterator();
            while(iter.hasNext()){
                thrd = (JMeterThread) iter.next();
                if (thrd.getThreadName().equals(threadName)){
                    break; // Found matching thread
                }
            }
        }
        if (thrd != null) {
            thrd.stop();
            thrd.interrupt();
            if (now) {
                Thread t = (Thread) engine.allThreads.get(thrd);
                if (t != null) {
                    t.interrupt();
                }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

            }

            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));
                final String threadName = groupName + " " + (groupCount) + "-" + (i + 1);
                jmeterThread.setThreadName(threadName);

                scheduleThread(jmeterThread, group);

                // Set up variables for stop handling
                jmeterThread.setEngine(this);
                jmeterThread.setOnErrorStopTest(onErrorStopTest);
                jmeterThread.setOnErrorStopTestNow(onErrorStopTestNow);
                jmeterThread.setOnErrorStopThread(onErrorStopThread);

                Thread newThread = new Thread(jmeterThread);
                newThread.setName(threadName);
                allThreads.put(jmeterThread, newThread);
                newThread.start();
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

    private void tellThreadsToStop() {
        synchronized (allThreads) { // Protect iterator
            Iterator iter = new HashSet(allThreads.keySet()).iterator();
            while (iter.hasNext()) {
                JMeterThread item = (JMeterThread) iter.next();
                item.stop(); // set stop flag
                item.interrupt(); // interrupt sampler if possible
                Thread t = (Thread) allThreads.get(item);
                t.interrupt(); // also interrupt JVM thread
            }
        }
    }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

    private void stopAllThreads() {
        synchronized (allThreads) {// Protect iterator
            Iterator iter = new HashSet(allThreads.keySet()).iterator();
            while (iter.hasNext()) {
                JMeterThread item = (JMeterThread) iter.next();
                item.stop(); // This is quick
            }
        }
    }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

            {
                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());
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

    private void tellThreadsToStop()
    {
        Iterator iter = new HashSet(allThreads.keySet()).iterator();
        while (iter.hasNext())
        {
            JMeterThread item = (JMeterThread) iter.next();
            item.stop();
            Thread t = (Thread) allThreads.get(item);
            if (t != null)
            {
                t.interrupt();
            }
            else
            {
                log.warn("Lost thread: " + item.getThreadName());
                allThreads.remove(item);
            }
        }
    }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

      return stopThread(threadName,true);
    }
    private static boolean stopThread(String threadName, boolean now)
    {
      if (allThreadNames == null) return false;// e.g. not yet started
      JMeterThread thrd;
    try {
          thrd = (JMeterThread)allThreadNames.get(threadName);
      } catch (Exception e) {
        log.warn("stopThread: "+e);
        return false;
      }
      if (thrd!= null)
      {
        thrd.stop();
        if (now)
        {
            Thread t = (Thread) allThreadsSave.get(thrd);
            if (t != null)
            {
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

            {
                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());
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

    private void tellThreadsToStop()
    {
        Iterator iter = new HashSet(allThreads.keySet()).iterator();
        while (iter.hasNext())
        {
            JMeterThread item = (JMeterThread) iter.next();
            item.stop();
            Thread t = (Thread) allThreads.get(item);
            if (t != null)
            {
                t.interrupt();
            }
            else
            {
                log.warn("Lost thread: " + item.getThreadName());
                allThreads.remove(item);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.