本文整理了Java中org.apache.jmeter.threads.JMeterContext.getThreadNum()
方法的一些代码示例,展示了JMeterContext.getThreadNum()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMeterContext.getThreadNum()
方法的具体详情如下:
包路径:org.apache.jmeter.threads.JMeterContext
类名称:JMeterContext
方法名:getThreadNum
[英]Returns the threadNum.
[中]返回threadNum。
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
log.debug("Cache hit thr#{}: {} => {}", JMeterContextService.getContext().getThreadNum(), host,
Arrays.toString(result));
InetAddress[] staticAddresses = fromStaticHost(host);
if (log.isDebugEnabled()) {
log.debug("Cache miss thr#{}: (static) {} => {}", JMeterContextService.getContext().getThreadNum(), host,
Arrays.toString(staticAddresses));
InetAddress[] addresses = requestLookup(host);
if (log.isDebugEnabled()) {
log.debug("Cache miss thr#{}: {} => {}", JMeterContextService.getContext().getThreadNum(), host,
Arrays.toString(addresses));
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
/**
* @see org.apache.jmeter.control.GenericController#initialize()
*/
@Override
public void initialize() {
super.initialize();
// get a different start index
if(getInterleaveAccrossThreads()) {
this.current = getThreadContext().getThreadNum() % getSubControllers().size();
}
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
private CollectionProperty getValues() {
CollectionProperty threadValues = (CollectionProperty) getProperty(THREAD_VALUES);
if (threadValues.size() > 0) {
return (CollectionProperty) threadValues.get(getThreadContext().getThreadNum() % threadValues.size());
}
return new CollectionProperty("noname", new LinkedList<>());
}
代码示例来源:origin: tuanhiep/mqtt-jmeter
public void setupTest(String host, String clientId, int size) {
try {
JMeterContext jmcx = JMeterContextService.getContext();
this.connectionArray= new FutureConnection[size];
if(size==1){
this.connectionArray[0]= createConnection(host,clientId+jmcx.getThreadNum());
this.connectionArray[0].connect().await();
this.getLogger().info("NUMBER CONNECTION: "+PublisherSampler.numberOfConnection.getAndIncrement());
}
else
{
for(int i = 0;i< size;i++){
this.connectionArray[i]= createConnection(host,clientId+jmcx.getThreadNum()+i);
this.connectionArray[i].connect().await();
this.getLogger().info("NUMBER CONNECTION: "+PublisherSampler.numberOfConnection.getAndIncrement());
}
}
} catch (Exception e) {
getLogger().error(e.getMessage());
}
}
public void setupTest(String host, String clientId, String user, String password, int size) {
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
if (log.isDebugEnabled()) {
log.debug("Cache miss: {} Thread #{}, resolved with system resolver into {}", host,
JMeterContextService.getContext().getThreadNum(), Arrays.toString(addresses));
代码示例来源:origin: tuanhiep/mqtt-jmeter
public void setupTest(String host, String clientId, String user, String password, int size) {
try {
JMeterContext jmcx = JMeterContextService.getContext();
this.connectionArray= new FutureConnection[size];
if(size==1){
this.connectionArray[0]= createConnection(host,clientId+jmcx.getThreadNum(),user,password);
this.connectionArray[0].connect().await();
this.getLogger().info("NUMBER CONNECTION: "+PublisherSampler.numberOfConnection.getAndIncrement());
}
else {
for(int i = 0;i< size;i++){
this.connectionArray[i]= createConnection(host,clientId+jmcx.getThreadNum()+i,user,password);
this.connectionArray[i].connect().await();
this.getLogger().info("NUMBER CONNECTION: "+PublisherSampler.numberOfConnection.getAndIncrement());
}
}
getLogger().info("Connection successful..");
} catch (Exception e) {
getLogger().error(e.getMessage());
}
}
代码示例来源:origin: tuanhiep/mqtt-jmeter
if (size == 1) {
this.connectionArray[0] = createConnection(host, clientId
+ jmcx.getThreadNum(), durable);
this.connectionArray[0].listener(new ListenerforSubscribe());
CallbackforSubscribe cbs = new CallbackforSubscribe();
for (int j = 0; j < size; j++) {
this.connectionArray[j] = createConnection(host, clientId
+ jmcx.getThreadNum() + j, durable);
this.connectionArray[j]
.listener(new ListenerforSubscribe());
String[] topicArray = topic.split("\\s*,\\s*");
this.connectionArray[r] = createConnection(host, clientId
+ jmcx.getThreadNum() + r, durable);
this.connectionArray[r].listener(new ListenerforSubscribe());
CallbackforSubscribe cbs = new CallbackforSubscribe();
代码示例来源:origin: tuanhiep/mqtt-jmeter
if (size == 1) {
this.connectionArray[0] = createConnection(host, clientId
+ jmcx.getThreadNum(), durable, user, password);
this.connectionArray[0].listener(new ListenerforSubscribe());
CallbackforSubscribe cbs = new CallbackforSubscribe();
for (int j = 0; j < size; j++) {
this.connectionArray[j] = createConnection(host, clientId
+ jmcx.getThreadNum() + j, durable, user, password);
this.connectionArray[j]
.listener(new ListenerforSubscribe());
int r = rand.nextInt(size);
this.connectionArray[r] = createConnection(host, clientId
+ jmcx.getThreadNum() + r, durable, user, password);
this.connectionArray[r]
.listener(new ListenerforSubscribe());
代码示例来源:origin: undera/jmeter-plugins
/**
* Update the worker thread jmeter context with the main thread one
* @param isInit if true the context a full copy is done, if false only update is done
*/
private void syncContext(boolean isInit)
{
// jmeter context synchronisation
JMeterContext current = JMeterContextService.getContext();
JMeterContext ctx = this.getThreadContext();
if (isInit)
{
current.setCurrentSampler(ctx.getCurrentSampler());
current.setEngine(ctx.getEngine());
current.setRestartNextLoop(ctx.isRestartNextLoop());
current.setSamplingStarted(ctx.isSamplingStarted());
current.setThread(ctx.getThread());
current.setThreadGroup(ctx.getThreadGroup());
current.setThreadNum(ctx.getThreadNum());
}
current.setVariables(ctx.getVariables());
current.setPreviousResult(ctx.getPreviousResult());
//current.getSamplerContext().putAll(ctx.getSamplerContext());
}
@Override
代码示例来源:origin: undera/jmeter-plugins
/**
* Update the worker thread jmeter context with the main thread one
* @param isInit if true the context a full copy is done, if false only update is done
*/
private void syncContext(boolean isInit)
{
// jmeter context synchronisation
JMeterContext current = JMeterContextService.getContext();
JMeterContext ctx = this.getThreadContext();
if (isInit)
{
current.setCurrentSampler(ctx.getCurrentSampler());
current.setEngine(ctx.getEngine());
current.setRestartNextLoop(ctx.isRestartNextLoop());
current.setSamplingStarted(ctx.isSamplingStarted());
current.setThread(ctx.getThread());
current.setThreadGroup(ctx.getThreadGroup());
current.setThreadNum(ctx.getThreadNum());
}
current.setVariables(ctx.getVariables());
current.setPreviousResult(ctx.getPreviousResult());
//current.getSamplerContext().putAll(ctx.getSamplerContext());
}
代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter
/**
* Update the worker thread jmeter context with the main thread one
* @param isInit if true the context a full copy is done, if false only update is done
*/
private void syncContext(boolean isInit)
{
// jmeter context synchronisation
JMeterContext current = JMeterContextService.getContext();
JMeterContext ctx = this.getThreadContext();
if (isInit)
{
current.setCurrentSampler(ctx.getCurrentSampler());
current.setEngine(ctx.getEngine());
current.setRestartNextLoop(ctx.isRestartNextLoop());
current.setSamplingStarted(ctx.isSamplingStarted());
current.setThread(ctx.getThread());
current.setThreadGroup(ctx.getThreadGroup());
current.setThreadNum(ctx.getThreadNum());
}
current.setVariables(ctx.getVariables());
current.setPreviousResult(ctx.getPreviousResult());
//current.getSamplerContext().putAll(ctx.getSamplerContext());
}
内容来源于网络,如有侵权,请联系作者删除!