本文整理了Java中org.apache.jmeter.threads.JMeterContextService.getContext()
方法的一些代码示例,展示了JMeterContextService.getContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMeterContextService.getContext()
方法的具体详情如下:
包路径:org.apache.jmeter.threads.JMeterContextService
类名称:JMeterContextService
方法名:getContext
[英]Gives access to the current thread context.
[中]提供对当前线程上下文的访问。
代码示例来源:origin: undera/jmeter-plugins
@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();
}
代码示例来源:origin: undera/jmeter-plugins
@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();
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_java
/**
*
* @return {@link JMeterContext}
*/
public JMeterContext getJMeterContext() {
return JMeterContextService.getContext();
}
/**
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_java
/**
* @return {@link JMeterVariables}
*/
public final JMeterVariables getJMeterVariables() {
return JMeterContextService.getContext().getVariables();
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
private JMeterVariables getVariables() {
JMeterContext context = JMeterContextService.getContext();
return context.getVariables();
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
/**
* Gives access to the JMeter variables for the current thread.
*
* @return a pointer to the JMeter variables.
*/
protected JMeterVariables getVariables() {
return JMeterContextService.getContext().getVariables();
}
代码示例来源:origin: kg.apc/jmeter-plugins-casutg
public AbstractThreadStarter(int groupIndex, AbstractDynamicThreadGroup owner, ListedHashTree listedHashTree, ListenerNotifier listenerNotifier, StandardJMeterEngine standardJMeterEngine) {
super();
this.owner = owner;
this.treeClone = cloneTree(listedHashTree); // it needs owner inside
this.engine = standardJMeterEngine;
this.groupIndex = groupIndex;
this.threadGroupTree = listedHashTree;
this.notifier = listenerNotifier;
this.context = JMeterContextService.getContext();
setDaemon(true);
}
代码示例来源:origin: undera/jmeter-plugins
public AbstractThreadStarter(int groupIndex, AbstractDynamicThreadGroup owner, ListedHashTree listedHashTree, ListenerNotifier listenerNotifier, StandardJMeterEngine standardJMeterEngine) {
super();
this.owner = owner;
this.treeClone = cloneTree(listedHashTree); // it needs owner inside
this.engine = standardJMeterEngine;
this.groupIndex = groupIndex;
this.threadGroupTree = listedHashTree;
this.notifier = listenerNotifier;
this.context = JMeterContextService.getContext();
setDaemon(true);
}
代码示例来源:origin: kg.apc/jmeter-plugins-standard
public AbstractThreadStarter(int groupIndex, AbstractDynamicThreadGroup owner, ListedHashTree listedHashTree, ListenerNotifier listenerNotifier, StandardJMeterEngine standardJMeterEngine) {
super();
this.owner = owner;
this.treeClone = cloneTree(listedHashTree); // it needs owner inside
this.engine = standardJMeterEngine;
this.groupIndex = groupIndex;
this.threadGroupTree = listedHashTree;
this.notifier = listenerNotifier;
this.context = JMeterContextService.getContext();
setDaemon(true);
}
代码示例来源:origin: undera/jmeter-plugins
private void processVariables() {
final Arguments args1 = (Arguments) this.getUserDefinedVariablesAsProperty().getObjectValue();
Arguments args = (Arguments) args1.clone();
final JMeterVariables vars = JMeterContextService.getContext().getVariables();
Iterator<Entry<String, String>> it = args.getArgumentsAsMap().entrySet().iterator();
Entry<String, String> var;
while (it.hasNext()) {
var = it.next();
log.debug("Setting " + var.getKey() + "=" + var.getValue());
vars.put(var.getKey(), var.getValue());
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
/**
* 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);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
/**
* @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);
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
public String execute() {
if (isDynamic || permanentResults == null) {
JMeterContext context = JMeterContextService.getContext();
SampleResult previousResult = context.getPreviousResult();
Sampler currentSampler = context.getCurrentSampler();
return execute(previousResult, currentSampler);
}
return permanentResults; // $NON-NLS-1$
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
public String execute() throws InvalidVariableException {
JMeterContext context = JMeterContextService.getContext();
SampleResult previousResult = context.getPreviousResult();
Sampler currentSampler = context.getCurrentSampler();
return execute(previousResult, currentSampler);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
@Override
public void threadStarted() {
if(getGroupSize() == 0) {
int numThreadsInGroup = JMeterContextService.getContext().getThreadGroup().getNumThreads();
// Unique Barrier creation ensured by synchronized setup
this.barrier.setup(numThreadsInGroup);
}
}
代码示例来源:origin: undera/jmeter-plugins
@Override
public void run() {
try {
// Copy in ThreadStarter thread context from calling Thread
JMeterContextService.getContext().setVariables(this.context.getVariables());
supplyActiveThreads();
} catch (InterruptedException e) {
log.debug("Interrupted", e);
}
log.debug("Thread starter has done its job");
}
代码示例来源:origin: kg.apc/jmeter-plugins-casutg
@Override
public void run() {
try {
// Copy in ThreadStarter thread context from calling Thread
JMeterContextService.getContext().setVariables(this.context.getVariables());
supplyActiveThreads();
} catch (InterruptedException e) {
log.debug("Interrupted", e);
}
log.debug("Thread starter has done its job");
}
代码示例来源:origin: kg.apc/jmeter-plugins-standard
public void startNextLoop() {
JMeterThread thread = JMeterContextService.getContext().getThread();
if (owner instanceof ArrivalsThreadGroup) {
getOwnerAsArrivals().abandonFact(thread, iterationNo);
}
if (!moveToPool(thread)) {
setDone(true);
}
}
代码示例来源:origin: undera/jmeter-plugins
public void startNextLoop() {
JMeterThread thread = JMeterContextService.getContext().getThread();
if (owner instanceof ArrivalsThreadGroup) {
getOwnerAsArrivals().abandonFact(thread, iterationNo);
if (!moveToPool(thread)) {
setDone(true);
}
} else {
reInitialize();
}
}
代码示例来源:origin: kg.apc/jmeter-plugins-casutg
public void startNextLoop() {
JMeterThread thread = JMeterContextService.getContext().getThread();
if (owner instanceof ArrivalsThreadGroup) {
getOwnerAsArrivals().abandonFact(thread, iterationNo);
if (!moveToPool(thread)) {
setDone(true);
}
} else {
reInitialize();
}
}
内容来源于网络,如有侵权,请联系作者删除!