Class AbstractSampleConsumer

All Implemented Interfaces:
SampleConsumer, SampleProcessor, SampleProducer
Direct Known Subclasses:
AbstractGraphConsumer, AbstractSummaryConsumer, AggregateConsumer, ExternalSampleSorter, FilterConsumer, NormalizerSampleConsumer, RequestsSummaryConsumer, SampleWriterConsumer, TaggerConsumer

public abstract class AbstractSampleConsumer extends AbstractSampleProcessor implements SampleConsumer, SampleProducer
Base class for sample consumer implementations.
Every sample consumer should extends this class to support basic consumer features.
  • Constructor Details

    • AbstractSampleConsumer

      public AbstractSampleConsumer()
  • Method Details

    • getDataFromContext

      protected final Object getDataFromContext(String key)
      Gets the data identified by the specified key from the current sample context
      key - the key
      the data
    • setDataToContext

      protected final void setDataToContext(String key, Object value)
      Store data in the current sample context with the specified key identifier.
      key - the key
      value - the value
    • getName

      public String getName()
      Gets the name of the consumer.
      the name of the consumer
    • setName

      public void setName(String name)
      Sets the name of the consumer.
      name - the new name
    • getWorkingDirectory

      public final File getWorkingDirectory()
    • setSampleContext

      public void setSampleContext(SampleContext sampleContext)
      Description copied from interface: SampleProcessor
      Set sample context that this consumer should rely on.
      Specified by:
      setSampleContext in interface SampleProcessor
      setSampleContext in class AbstractSampleProcessor
      sampleContext - the new sample context
    • setSampleConsumers

      public void setSampleConsumers(List<SampleConsumer> consumers)
      Sets the consumers
      consumers - for the samples (must not be null)
    • addSampleConsumer

      public void addSampleConsumer(SampleConsumer consumer)
    • setSampleConsumer

      public void setSampleConsumer(SampleConsumer consumer)
    • removeSampleConsumer

      public void removeSampleConsumer(SampleConsumer consumer)
    • setConsumedMetadata

      public void setConsumedMetadata(SampleMetadata sampleMetadata, int channel)
      Description copied from interface: SampleConsumer
      Set the metadata of samples that will be consumed on the specified channel.
      Specified by:
      setConsumedMetadata in interface SampleConsumer
      sampleMetadata - The sample metadata that are being consumed for the associated channel
      channel - The channel whose sample metadata are being defined
    • getConsumedMetadata

      public SampleMetadata getConsumedMetadata(int channel)
    • getConsumedChannelCount

      public int getConsumedChannelCount()
    • setChannelAttribute

      public void setChannelAttribute(int channel, String key, Object value)
      Description copied from interface: SampleProcessor
      Associate an attribute to the specified channel for this sample processor
      If the attribute already exist, it is replaced.
      Specified by:
      setChannelAttribute in interface SampleProcessor
      setChannelAttribute in class AbstractSampleProcessor
      channel - The channel number to associate the attribute on
      key - The attribute key
      value - The attribute value to be set
    • setProducedMetadata

      public void setProducedMetadata(SampleMetadata metadata, int channel)
      Description copied from interface: SampleProducer
      Set the metadata associated with the specified channel
      Specified by:
      setProducedMetadata in interface SampleProducer
      metadata - The metadata to be associated to the specified channel
      channel - The channel whoses metadata are being associated with
    • getConsumer

      protected SampleConsumer getConsumer(int i)
    • startProducing

      public void startProducing()
      Description copied from interface: SampleProducer
      Start producing samples, must be invoked before any call to produce()
      Specified by:
      startProducing in interface SampleProducer
    • produce

      public void produce(Sample s, int channel)
      Description copied from interface: SampleProducer
      Produce a single sample on the specified channel
      Specified by:
      produce in interface SampleProducer
      s - The sample produced
      channel - The channel on which is produced the sample
    • stopProducing

      public void stopProducing()
      Description copied from interface: SampleProducer
      Stop producing samples, no produce() call should occur after this service has been called.
      Specified by:
      stopProducing in interface SampleProducer