Examples of JMeterThread


Examples of org.apache.jmeter.threads.JMeterThread

    {
      ThreadGroup group = (ThreadGroup)iter.next();
      threads = new JMeterThread[group.getNumThreads()];
      for(int i = 0; i < threads.length; i++)
      {
        threads[i] = new JMeterThread(group);
        Thread newThread = new Thread(threads[i]);
        allThreads.add(threads[i]);
        System.out.println("Starting thread");
        newThread.start();
      }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

  public void stopTest()
  {
    Iterator iter = allThreads.iterator();
    while(iter.hasNext())
    {
      JMeterThread item = (JMeterThread)iter.next();
      item.stop();
    }
    allThreads.clear();
  }
View Full Code Here

Examples of org.apache.jmeter.threads.JMeterThread

  }

  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) {
          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));
        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;
        }
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

  }

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

Examples of org.apache.jmeter.threads.JMeterThread

  }

  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) {
          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));
        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;
        }
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

  }

  private void stopAllThreads() {
    Iterator iter = new HashSet(allThreads.keySet()).iterator();
    while (iter.hasNext()) {
      JMeterThread item = (JMeterThread) iter.next();
      item.stop();
    }
  }
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.