/** * Gives access to the JMeter variables for the current thread. * * @return a pointer to the JMeter variables. */ protected JMeterVariables getVariables() { return JMeterContextService.getContext().getVariables(); }
public static void decrNumberOfThreads() { JMeterContextService.decrNumberOfThreads(); refreshUI(); }
public static void incrNumberOfThreads() { JMeterContextService.incrNumberOfThreads(); refreshUI(); }
/** * @param elementName Test Element * @param iterCount iteration count */ default void updateIterationIndex(String elementName, int iterCount) { JMeterVariables variables = JMeterContextService.getContext().getVariables(); if(variables != null) { variables.putObject( JMeterUtils.formatJMeterExportedVariableName(elementName+GenericController.INDEX_VAR_NAME_SUFFIX), iterCount); } }
/** * Adjust delay so that initialDelay does not exceed end of test * @param initialDelay initial delay in millis * @return initialDelay or adjusted delay */ public long adjustDelay(final long initialDelay) { JMeterThread thread = JMeterContextService.getContext().getThread(); long endTime = thread != null ? thread.getEndTime() : 0; return adjustDelay(initialDelay, endTime); }
@Override /** * Get current thread group using sampler's context */ public String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { JMeterContext context; if (currentSampler != null) { context = currentSampler.getThreadContext(); } else { context = JMeterContextService.getContext(); } return context.getThreadGroup().getName(); }
@Override public void sampleOccurred(SampleEvent event) { // just dropping regular test samples // update JMeterContext for share with samplers thread in order to provide // updated variables this.ctx = JMeterContextService.getContext(); }
public void setInitialContext(JMeterContext context) { threadVars.putAll(context.getVariables()); }
@Override public void stop() { stopping = true; super.stop(); }
private void saveVars(JMeterVariables vars){ for(int i = 0; i < variableNames.length; i++){ values[i] = vars.get(variableNames[i]); } }
/** * @return true if test is running */ public static boolean isTestRunning() { return JMeterContextService.getTestStartTime()>0; }
/** * @return boolean true if all threads of all Thread Groups stopped */ private boolean verifyThreadsStopped() { boolean stoppedAll = true; // ConcurrentHashMap does not need synch. here for (AbstractThreadGroup threadGroup : groups) { stoppedAll = stoppedAll && threadGroup.verifyThreadsStopped(); } return stoppedAll; }
/** * Wait for Group Threads to stop */ private void waitThreadsStopped() { // ConcurrentHashMap does not need synch. here for (AbstractThreadGroup threadGroup : groups) { threadGroup.waitThreadsStopped(); } }
private static boolean stopThread(String threadName, boolean now) { if (engine == null) { return false;// e.g. not yet started } boolean wasStopped = false; // ConcurrentHashMap does not need synch. here for (AbstractThreadGroup threadGroup : engine.groups) { wasStopped = wasStopped || threadGroup.stopThread(threadName, now); } return wasStopped; }
/** * @return {@link JMeterVariables} */ public final JMeterVariables getJMeterVariables() { return JMeterContextService.getContext().getVariables(); }
public static void decrNumberOfThreads() { JMeterContextService.decrNumberOfThreads(); refreshUI(); }
public static void incrNumberOfThreads() { JMeterContextService.incrNumberOfThreads(); refreshUI(); }
private JMeterVariables getVariables() { JMeterContext context = JMeterContextService.getContext(); return context.getVariables(); }
public static void decrNumberOfThreads() { JMeterContextService.decrNumberOfThreads(); refreshUI(); }
public static void incrNumberOfThreads() { JMeterContextService.incrNumberOfThreads(); refreshUI(); }