Class JavaSampler
-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable,org.apache.jmeter.engine.util.ConfigMergabilityIndicator,org.apache.jmeter.gui.Searchable,org.apache.jmeter.samplers.Interruptible,org.apache.jmeter.samplers.Sampler,org.apache.jmeter.testelement.TestElement,org.apache.jmeter.testelement.TestStateListener
public class JavaSampler extends AbstractSampler implements TestStateListener, InterruptibleA sampler for executing custom Java code in each sample. See JavaSamplerClient and AbstractJavaSamplerClient for information on writing Java code to be executed by this sampler.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringCLASSNAMEpublic final static StringARGUMENTSpublic transient JMeterContextthreadContextpublic transient StringthreadNamepublic final static TestElement.CompanionCompanionpublic final static StringNAMEpublic final static StringGUI_CLASSpublic final static StringENABLEDpublic final static StringTEST_CLASSpublic final static StringCOMMENTS
-
Constructor Summary
Constructors Constructor Description JavaSampler()Create a JavaSampler.
-
Method Summary
Modifier and Type Method Description Objectclone()voidsetArguments(Arguments args)Set the arguments (parameters) for the JavaSamplerClient to be executed with. ArgumentsgetArguments()Get the arguments (parameters) for the JavaSamplerClient to be executed with. voidsetClassname(String classname)Sets the Classname attribute of the JavaConfig object StringgetClassname()Gets the Classname attribute of the JavaConfig object SampleResultsample(Entry entry)Performs a test sample. voidtestStarted()voidtestStarted(String host)voidtestEnded()Method called at the end of the test. voidtestEnded(String host)booleanapplies(ConfigTestElement configElement)booleaninterrupt()-
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addTestElement, canRemove, clear, clearTestElementChildren, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse -
Methods inherited from class org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProps, getSchema, getString, removed, set -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
setArguments
void setArguments(Arguments args)
Set the arguments (parameters) for the JavaSamplerClient to be executed with.
- Parameters:
args- the new arguments.
-
getArguments
Arguments getArguments()
Get the arguments (parameters) for the JavaSamplerClient to be executed with.
-
setClassname
void setClassname(String classname)
Sets the Classname attribute of the JavaConfig object
- Parameters:
classname- the new Classname value
-
getClassname
String getClassname()
Gets the Classname attribute of the JavaConfig object
-
sample
SampleResult sample(Entry entry)
Performs a test sample. The
sample()method retrieves the reference to the Java client and calls itsrunTest()method.- Parameters:
entry- the Entry for this sample
-
testStarted
void testStarted()
-
testStarted
void testStarted(String host)
-
testEnded
void testEnded()
Method called at the end of the test. This is called only on one instance of JavaSampler. This method will loop through all of the other JavaSamplers which have been registered (automatically in the constructor) and notify them that the test has ended, allowing the JavaSamplerClients to cleanup.
-
applies
boolean applies(ConfigTestElement configElement)
-
interrupt
boolean interrupt()
-
-
-
-