Class JMeterThread
-
- All Implemented Interfaces:
-
java.lang.Runnable
,org.apache.jmeter.samplers.Interruptible
public class JMeterThread implements 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 Modifier and Type Field Description public final static String
PACKAGE_OBJECT
public final static String
LAST_SAMPLE_OK
public final ListenerNotifier
notifier
public String
threadName
public int
threadNum
public long
startTime
public long
endTime
-
Constructor Summary
Constructors Constructor Description JMeterThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifier note)
JMeterThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifier note, Boolean isSameUserOnNextIteration)
-
Method Summary
Modifier and Type Method Description ListenerNotifier
getNotifier()
String
getThreadName()
void
setThreadName(String threadName)
int
getThreadNum()
Returns the threadNum. void
setThreadNum(int threadNum)
Sets the threadNum. long
getStartTime()
Get the start time value. void
setStartTime(long stime)
Set the StartTime for this Thread. long
getEndTime()
Get the end time value. void
setEndTime(long etime)
Set the EndTime for this Thread. void
setInitialContext(JMeterContext context)
void
putVariables(JMeterVariables variables)
Updates the variables with all entries found in the variables in vars
void
setScheduled(boolean sche)
Enable the scheduler for this JMeterThread. void
run()
void
stop()
Set running flag to false which will interrupt JMeterThread on next flag test. boolean
interrupt()
Interrupt the current operation if possible. ListedHashTree
getTestTree()
void
setInitialDelay(int delay)
Set rampup delay for JMeterThread Thread void
setEngine(StandardJMeterEngine engine)
Save the engine instance for access to the stop methods void
setOnErrorStopTest(boolean b)
Should Test stop on sampler error? void
setOnErrorStopTestNow(boolean b)
Should Test stop abruptly on sampler error? void
setOnErrorStopThread(boolean b)
Should Thread stop on Sampler error? void
setOnErrorStartNextLoop(boolean b)
Should Thread start next loop on Sampler error? void
setThreadGroup(AbstractThreadGroup group)
-
-
Constructor Detail
-
JMeterThread
JMeterThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifier note)
-
JMeterThread
JMeterThread(HashTree test, JMeterThreadMonitor monitor, ListenerNotifier note, Boolean isSameUserOnNextIteration)
-
-
Method Detail
-
getNotifier
ListenerNotifier getNotifier()
- Returns:
-
getThreadName
String getThreadName()
-
setThreadName
void setThreadName(String threadName)
-
getThreadNum
int getThreadNum()
Returns the threadNum.
- Returns:
the threadNum
-
setThreadNum
void setThreadNum(int threadNum)
Sets the threadNum.
- Parameters:
threadNum
- the threadNum to set
-
getStartTime
long getStartTime()
Get the start time value.
- Returns:
the start time value.
-
setStartTime
void setStartTime(long stime)
Set the StartTime for this Thread.
- Parameters:
stime
- the StartTime value.
-
getEndTime
long getEndTime()
Get the end time value.
- Returns:
the end time value.
-
setEndTime
void setEndTime(long etime)
Set the EndTime for this Thread.
- Parameters:
etime
- the EndTime value.
-
setInitialContext
@Deprecated()@API(status = API.Status.DEPRECATED, since = "5.5") void setInitialContext(JMeterContext context)
-
putVariables
@API(status = API.Status.STABLE, since = "5.5") void putVariables(JMeterVariables variables)
Updates the variables with all entries found in the variables in
vars
- Parameters:
variables
- JMeterVariables with the entries to be updated
-
setScheduled
void setScheduled(boolean sche)
Enable the scheduler for this JMeterThread.
- Parameters:
sche
- flag whether the scheduler should be enabled
-
run
void run()
-
stop
void stop()
Set running flag to false which will interrupt JMeterThread on next flag test. This is a clean shutdown.
-
interrupt
boolean interrupt()
Interrupt the current operation if possible.
-
getTestTree
ListedHashTree getTestTree()
- Returns:
ListedHashTree
-
setInitialDelay
void setInitialDelay(int delay)
Set rampup delay for JMeterThread Thread
- Parameters:
delay
- Rampup delay for JMeterThread
-
setEngine
void setEngine(StandardJMeterEngine engine)
Save the engine instance for access to the stop methods
- Parameters:
engine
- the engine which is used
-
setOnErrorStopTest
void setOnErrorStopTest(boolean b)
Should Test stop on sampler error?
- Parameters:
b
- true or false
-
setOnErrorStopTestNow
void setOnErrorStopTestNow(boolean b)
Should Test stop abruptly on sampler error?
- Parameters:
b
- true or false
-
setOnErrorStopThread
void setOnErrorStopThread(boolean b)
Should Thread stop on Sampler error?
- Parameters:
b
- true or false
-
setOnErrorStartNextLoop
void setOnErrorStartNextLoop(boolean b)
Should Thread start next loop on Sampler error?
- Parameters:
b
- true or false
-
setThreadGroup
void setThreadGroup(AbstractThreadGroup group)
-
-
-
-