org.apache.jmeter.visualizers.backend

## Class AbstractBackendListenerClient

- java.lang.Object
- - org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient

- All Implemented Interfaces:
    BackendListenerClient
  Direct Known Subclasses:
    GraphiteBackendListenerClient, InfluxdbBackendListenerClient

      public abstract class AbstractBackendListenerClient
      extends Object
      implements BackendListenerClient

  An abstract implementation of the BackendListenerClient interface. This implementation provides default implementations of most of the methods in the interface, as well as some convenience methods, in order to simplify development of BackendListenerClient implementations. While it may be necessary to make changes to the BackendListenerClient interface from time to time (therefore requiring changes to any implementations of this interface), we intend to make this abstract class provide reasonable implementations of any new methods so that subclasses do not necessarily need to be updated for new versions. Therefore, when creating a new BackendListenerClient implementation, developers are encouraged to subclass this abstract class rather than implementing the BackendListenerClient interface directly. Implementing BackendListenerClient directly will continue to be supported for cases where extending this class is not possible (for example, when the client class is already a subclass of some other class).

  The `BackendListenerClient.handleSampleResults(java.util.List, BackendListenerContext)` method of BackendListenerClient does not have a default implementation here, so subclasses must define at least this method. It may be useful to override other methods as well.

  Since:
    2.13
  See Also:
    `BackendListener.sampleOccurred(org.apache.jmeter.samplers.SampleEvent)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractBackendListenerClient()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `SampleResult` | `createSampleResult(BackendListenerContext context, SampleResult result)` Create a copy of SampleResult, this method is here to allow customizing what is kept in the copy, for example copy could remove some useless fields.
    `Arguments` | `getDefaultParameters()` Provide a list of parameters which this test supports.
    `protected Logger` | `getLogger()` Deprecated. Will be removed in 3.3, use `getNewLogger()`
    `protected Map<String,SamplerMetric>` | `getMetricsPerSampler()`
    `protected org.slf4j.Logger` | `getNewLogger()` Get a Logger instance which can be used by subclasses to log information.
    `protected SamplerMetric` | `getSamplerMetric(String sampleLabel)`
    `protected UserMetric` | `getUserMetrics()`
    `void` | `setupTest(BackendListenerContext context)` Do any initialization required by this client.
    `void` | `teardownTest(BackendListenerContext context)` Do any clean-up required at the end of a test run.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.visualizers.backend.BackendListenerClient

      `handleSampleResults`

- - ### Constructor Detail

    - #### AbstractBackendListenerClient

          public AbstractBackendListenerClient()

  - ### Method Detail

    - #### setupTest

          public void setupTest(BackendListenerContext context)
                         throws Exception

      Description copied from interface: `BackendListenerClient`
      Do any initialization required by this client. It is generally recommended to do any initialization such as getting parameter values in the setupTest method rather than the runTest method in order to add as little overhead as possible to the test.
      Specified by:
        `setupTest` in interface `BackendListenerClient`
      Parameters:
        `context` - the context to run with. This provides access to initialization parameters. Context is readonly
      Throws:
        `Exception` - when setup fails

    - #### teardownTest

          public void teardownTest(BackendListenerContext context)
                            throws Exception

      Description copied from interface: `BackendListenerClient`
      Do any clean-up required at the end of a test run.
      Specified by:
        `teardownTest` in interface `BackendListenerClient`
      Parameters:
        `context` - the context to run with. This provides access to initialization parameters.
      Throws:
        `Exception` - when tear down fails

    - #### getDefaultParameters

          public Arguments getDefaultParameters()

      Description copied from interface: `BackendListenerClient`
      Provide a list of parameters which this test supports. Any parameter names and associated values returned by this method will appear in the GUI by default so the user doesn't have to remember the exact names. The user can add other parameters which are not listed here. If this method returns null then no parameters will be listed. If the value for some parameter is null then that parameter will be listed in the GUI with an empty value.
      Specified by:
        `getDefaultParameters` in interface `BackendListenerClient`
      Returns:
        a specification of the parameters used by this test which should be listed in the GUI, or null if no parameters should be listed.

    - #### getLogger

          @Deprecated
          protected Logger getLogger()

      Deprecated. Will be removed in 3.3, use `getNewLogger()`
      Get a Logger instance which can be used by subclasses to log information. As this class is designed to be subclassed this is useful.
      Returns:
        a Logger instance which can be used for logging

    - #### getNewLogger

          protected org.slf4j.Logger getNewLogger()

      Get a Logger instance which can be used by subclasses to log information. As this class is designed to be subclassed this is useful.
      Returns:
        `Logger` instance which can be used for logging

    - #### createSampleResult

          public SampleResult createSampleResult(BackendListenerContext context,
                                                 SampleResult result)

      Create a copy of SampleResult, this method is here to allow customizing what is kept in the copy, for example copy could remove some useless fields. Note that if it returns null, the sample result is not put in the queue. Defaults to returning result.
      Specified by:
        `createSampleResult` in interface `BackendListenerClient`
      Parameters:
        `context` - `BackendListenerContext`
        `result` - `SampleResult`
      Returns:
        `SampleResult`

    - #### getSamplerMetric

          protected final SamplerMetric getSamplerMetric(String sampleLabel)

      Parameters:
        `sampleLabel` - Name of sample used as key
      Returns:
        `SamplerMetric`

    - #### getMetricsPerSampler

          protected Map<String,SamplerMetric> getMetricsPerSampler()

      Returns:
        Map where key is SampleLabel and `SamplerMetric` is the metrics of this Sample

    - #### getUserMetrics

          protected UserMetric getUserMetrics()

      Returns:
        `UserMetric`

Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.