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, Interruptible
                        

    A 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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaSampler() Create a JavaSampler.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Object clone()
      void setArguments(Arguments args) Set the arguments (parameters) for the JavaSamplerClient to be executed with.
      Arguments getArguments() Get the arguments (parameters) for the JavaSamplerClient to be executed with.
      void setClassname(String classname) Sets the Classname attribute of the JavaConfig object
      String getClassname() Gets the Classname attribute of the JavaConfig object
      SampleResult sample(Entry entry) Performs a test sample.
      void testStarted()
      void testStarted(String host)
      void testEnded() Method called at the end of the test.
      void testEnded(String host)
      boolean applies(ConfigTestElement configElement)
      boolean interrupt()
      • 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
    • Constructor Detail

      • JavaSampler

        JavaSampler()
        Create a JavaSampler.
    • 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 its runTest() method.

        Parameters:
        entry - the Entry for this sample
      • 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)