Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Thread Groups - Allow to run on JMeter lower than 5.2 #691

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

public abstract class AbstractThreadStarter extends Thread {
private static final Logger log = LoggerFactory.getLogger(AbstractThreadStarter.class);
private static final String[] jmeterVersion =
JMeterUtils.getJMeterVersion().split(" ")[0].split("\\.", 3);
private static final int JMETER_VERSION_MAJOR = Integer.parseInt(jmeterVersion[0]);
private static final int JMETER_VERSION_MINOR = Integer.parseInt(jmeterVersion[1]);
protected final ListenerNotifier notifier;
protected final ListedHashTree threadGroupTree;
protected final StandardJMeterEngine engine;
Expand Down Expand Up @@ -59,7 +63,13 @@ protected DynamicThread makeThread(long threadIndex) {
boolean onErrorStopTestNow = owner.getOnErrorStopTestNow();
boolean onErrorStopThread = owner.getOnErrorStopThread();
boolean onErrorStartNextLoop = owner.getOnErrorStartNextLoop();
final DynamicThread jmeterThread = new DynamicThread(treeClone, this.owner, notifier, owner.getSameUser());
DynamicThread jmeterThread;
if (JMETER_VERSION_MAJOR >= 5 && JMETER_VERSION_MINOR >=2) {
jmeterThread =
new DynamicThread(treeClone, this.owner, notifier, owner.getSameUser());
} else {
jmeterThread = new DynamicThread(treeClone, this.owner, notifier);
}
jmeterThread.setThreadNum((int) threadIndex);
jmeterThread.setThreadGroup(this.owner);
jmeterThread.setInitialContext(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public DynamicThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifie
super(test, monitor, note, isSameUserOnNextIteration);
}

public DynamicThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifier note) {
super(test, monitor, note);
}
public void setOSThread(Thread OSThread) {
this.osThread = OSThread;
}
Expand Down
Loading