Package org.apache.jmeter.threads
Class JMeterThread
java.lang.Object
org.apache.jmeter.threads.JMeterThread
- All Implemented Interfaces:
Runnable,Interruptible
The JMeter interface to the sampling process, allowing JMeter to see the
timing, add listeners for sampling events and to stop the sampling process.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJMeterThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifier note) JMeterThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifier note, Boolean isSameUserOnNextIteration) -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidWait for delay with RAMPUP_GRANULARITYlongGet the end time value.longGet the start time value.intReturns the threadNum.booleanInterrupt the current operation if possible.voidputVariables(JMeterVariables variables) Updates the variables with all entries found in the variables invarsvoidrun()voidsetEndTime(long etime) Set the EndTime for this Thread.voidsetEngine(StandardJMeterEngine engine) Save the engine instance for access to the stop methodsvoidsetInitialContext(JMeterContext context) Deprecated.voidsetInitialDelay(int delay) Set rampup delay for JMeterThread ThreadvoidsetOnErrorStartNextLoop(boolean b) Should Thread start next loop on Sampler error?voidsetOnErrorStopTest(boolean b) Should Test stop on sampler error?voidsetOnErrorStopTestNow(boolean b) Should Test stop abruptly on sampler error?voidsetOnErrorStopThread(boolean b) Should Thread stop on Sampler error?voidsetScheduled(boolean sche) Enable the scheduler for this JMeterThread.voidsetStartTime(long stime) Set the StartTime for this Thread.voidvoidsetThreadName(String threadName) voidsetThreadNum(int threadNum) Sets the threadNum.voidstop()Set running flag to false which will interrupt JMeterThread on next flag test.
-
Field Details
-
PACKAGE_OBJECT
- See Also:
-
LAST_SAMPLE_OK
- See Also:
-
-
Constructor Details
-
JMeterThread
-
JMeterThread
public JMeterThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifier note, Boolean isSameUserOnNextIteration)
-
-
Method Details
-
setInitialContext
@Deprecated @API(status=DEPRECATED, since="5.5") public void setInitialContext(JMeterContext context) Deprecated. -
putVariables
Updates the variables with all entries found in the variables invars- Parameters:
variables-JMeterVariableswith the entries to be updated
-
setScheduled
public void setScheduled(boolean sche) Enable the scheduler for this JMeterThread.- Parameters:
sche- flag whether the scheduler should be enabled
-
setStartTime
public void setStartTime(long stime) Set the StartTime for this Thread.- Parameters:
stime- the StartTime value.
-
getStartTime
public long getStartTime()Get the start time value.- Returns:
- the start time value.
-
setEndTime
public void setEndTime(long etime) Set the EndTime for this Thread.- Parameters:
etime- the EndTime value.
-
getEndTime
public long getEndTime()Get the end time value.- Returns:
- the end time value.
-
setThreadName
-
run
public void run() -
getThreadName
-
stop
public void stop()Set running flag to false which will interrupt JMeterThread on next flag test. This is a clean shutdown. -
interrupt
public boolean interrupt()Interrupt the current operation if possible.- Specified by:
interruptin interfaceInterruptible- Returns:
trueif there was an operation to interrupt.
-
setInitialDelay
public void setInitialDelay(int delay) Set rampup delay for JMeterThread Thread- Parameters:
delay- Rampup delay for JMeterThread
-
delayBy
Wait for delay with RAMPUP_GRANULARITY- Parameters:
delay- delay in mstype- Delay type
-
getThreadNum
public int getThreadNum()Returns the threadNum.- Returns:
- the threadNum
-
setThreadNum
public void setThreadNum(int threadNum) Sets the threadNum.- Parameters:
threadNum- the threadNum to set
-
setEngine
Save the engine instance for access to the stop methods- Parameters:
engine- the engine which is used
-
setOnErrorStopTest
public void setOnErrorStopTest(boolean b) Should Test stop on sampler error?- Parameters:
b- true or false
-
setOnErrorStopTestNow
public void setOnErrorStopTestNow(boolean b) Should Test stop abruptly on sampler error?- Parameters:
b- true or false
-
setOnErrorStopThread
public void setOnErrorStopThread(boolean b) Should Thread stop on Sampler error?- Parameters:
b- true or false
-
setOnErrorStartNextLoop
public void setOnErrorStartNextLoop(boolean b) Should Thread start next loop on Sampler error?- Parameters:
b- true or false
-
setThreadGroup
-
getTestTree
- Returns:
ListedHashTree
-
getNotifier
- Returns:
ListenerNotifier
-