Java Code Examples for org.apache.jmeter.threads.JMeterThread#stop()

The following examples show how to use org.apache.jmeter.threads.JMeterThread#stop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSimpleThreadGroup.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public boolean stopThread(String threadName, boolean now) {
    for (Entry<JMeterThread, Thread> entry : allThreads.entrySet()) {
        JMeterThread thrd = entry.getKey();
        if (thrd.getThreadName().equals(threadName)) {
            thrd.stop();
            thrd.interrupt();
            if (now) {
                Thread t = entry.getValue();
                if (t != null) {
                    t.interrupt();
                }
            }
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: AbstractSimpleThreadGroup.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void tellThreadsToStop() {
    running = false;
    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
        }
    }
}
 
Example 3
Source File: AbstractSimpleThreadGroup.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void stop() {
    running = false;
    for (JMeterThread item : allThreads.keySet()) {
        item.stop();
    }
}
 
Example 4
Source File: DummyThreadGroup.java    From jmeter-bzm-plugins with Apache License 2.0 4 votes vote down vote up
public void stopAllThreads() {
    for (JMeterThread thread : jMeterThreads) {
        thread.stop();
    }
}