Package org.apache.jmeter.threads
Class JMeterContextService
java.lang.Object
org.apache.jmeter.threads.JMeterContextService
Provides context service for JMeter threads.
Keeps track of active and total thread counts.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addTotalThreads
(int thisGroup) Update the total number of threadsstatic void
Set total threads to zero; also clears started and finished countsstatic void
endTest()
Called by MainFrame#testEnded().static JMeterVariables
Get all variables accessible for JMeter client in a distributed test (only test plan and user defined variables) Note this is a read-only collectionstatic JMeterContext
Gives access to the current thread context.static int
Get the number of currently active threadsstatic long
static int
Get the total number of threads (>= active)static void
initClientSideVariables
(JMeterVariables clientSideVariables) Set variables for JMeter client in a distributed test (INTERNAL API)static void
replaceContext
(JMeterContext context) Replace Thread Context by the parameter.static void
Reset client side variables in a distributed modestatic void
Method is called by the JMeterEngine class when a test run is started.
-
Method Details
-
getContext
Gives access to the current thread context.- Returns:
- the current thread Context
-
replaceContext
Replace Thread Context by the parameter.- Parameters:
context
-JMeterContext
-
startTest
public static void startTest()Method is called by the JMeterEngine class when a test run is started. Zeroes numberOfActiveThreads. Saves current time in a field and in the JMeter property "TESTSTART.MS" -
getNumberOfThreads
public static int getNumberOfThreads()Get the number of currently active threads- Returns:
- active thread count
-
getThreadCounts
-
endTest
public static void endTest()Called by MainFrame#testEnded(). Clears start time field. -
getTestStartTime
public static long getTestStartTime() -
getTotalThreads
public static int getTotalThreads()Get the total number of threads (>= active)- Returns:
- total thread count
-
addTotalThreads
public static void addTotalThreads(int thisGroup) Update the total number of threads- Parameters:
thisGroup
- number of threads in this thread group
-
clearTotalThreads
public static void clearTotalThreads()Set total threads to zero; also clears started and finished counts -
getClientSideVariables
Get all variables accessible for JMeter client in a distributed test (only test plan and user defined variables) Note this is a read-only collection- Returns:
JMeterVariables
available for JMeter client
-
initClientSideVariables
Set variables for JMeter client in a distributed test (INTERNAL API)- Parameters:
clientSideVariables
-JMeterVariables
-
resetClientSideVariables
public static void resetClientSideVariables()Reset client side variables in a distributed mode
-