Package org.apache.jmeter.threads

Examples of org.apache.jmeter.threads.JMeterThread


    }

    private void tellThreadsToStop() {
        // ConcurrentHashMap does not need protecting
        for (Entry<JMeterThread, Thread> entry : allThreads.entrySet()) {
            JMeterThread item = entry.getKey();
            item.stop(); // set stop flag
            item.interrupt(); // interrupt sampler if possible
            Thread t = entry.getValue();
            if (t != null ) { // Bug 49734
                t.interrupt(); // also interrupt JVM thread
            }
        }
View Full Code Here


  }

  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

      }

            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

  }

  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

  }

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

    // res.sampleStart();

    int target = getTarget();
    int action = getAction();
    if (target == THREAD) {
      JMeterThread thread = context.getThread();
      if (action == PAUSE) {
        // res.setSamplerData("Pause Thread "+thread.getThreadNum());
        thread.pauseThread(getDuration());
        // response.append("Thread ");
        // response.append(thread.getThreadNum());
        // response.append(" paused for ");
        // response.append(getDuration());
        // response.append(" miliseconds");
View Full Code Here

  }

  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

      }

            ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
            threadGroupTree.add(group, testLevelElements);
      for (int i = 0; running && i < threads.length; i++) {
        threads[i] = new JMeterThread(cloneTree(threadGroupTree), this, notifier);
        threads[i].setThreadNum(i);
        threads[i].setThreadGroup(group);
        threads[i].setInitialContext(JMeterContextService.getContext());
        threads[i].setInitialDelay((int) (perThreadDelay * i));
        threads[i].setThreadName(groupName + " " + (groupCount) + "-" + (i + 1));
View Full Code Here

  }

  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

  }

  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

Related Classes of org.apache.jmeter.threads.JMeterThread

Copyright © 2018 www.massapicom. 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.