Class AbstractSampleConsumer
java.lang.Object
org.apache.jmeter.report.processor.AbstractSampleProcessor
org.apache.jmeter.report.processor.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.
Every sample consumer should extends this class to support basic consumer features.
- Since:
- 3.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSampleConsumer
(SampleConsumer consumer) int
getConsumedMetadata
(int channel) protected SampleConsumer
getConsumer
(int i) protected final Object
getDataFromContext
(String key) Gets the data identified by the specified key from the current sample contextgetName()
Gets the name of the consumer.final File
void
Produce a single sample on the specified channelvoid
removeSampleConsumer
(SampleConsumer consumer) void
setChannelAttribute
(int channel, String key, Object value) Associate an attribute to the specified channel for this sample processor
If the attribute already exist, it is replaced.void
setConsumedMetadata
(SampleMetadata sampleMetadata, int channel) Set the metadata of samples that will be consumed on the specified channel.protected final void
setDataToContext
(String key, Object value) Store data in the current sample context with the specified key identifier.void
Sets the name of the consumer.void
setProducedMetadata
(SampleMetadata metadata, int channel) Set the metadata associated with the specified channelvoid
setSampleConsumer
(SampleConsumer consumer) void
setSampleConsumers
(List<SampleConsumer> consumers) Sets the consumersvoid
setSampleContext
(SampleContext sampleContext) Set sample context that this consumer should rely on.void
Start producing samples, must be invoked before any call toproduce()
void
Stop producing samples, noproduce()
call should occur after this service has been called.Methods inherited from class org.apache.jmeter.report.processor.AbstractSampleProcessor
getChannelAttribute, getSampleContext
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.report.processor.SampleConsumer
consume, startConsuming, stopConsuming
Methods inherited from interface org.apache.jmeter.report.processor.SampleProcessor
getChannelAttribute, getSampleContext
-
Constructor Details
-
AbstractSampleConsumer
public AbstractSampleConsumer()
-
-
Method Details
-
getDataFromContext
Gets the data identified by the specified key from the current sample context- Parameters:
key
- the key- Returns:
- the data
-
setDataToContext
Store data in the current sample context with the specified key identifier.- Parameters:
key
- the keyvalue
- the value
-
getName
Gets the name of the consumer.- Returns:
- the name of the consumer
-
setName
Sets the name of the consumer.- Parameters:
name
- the new name
-
getWorkingDirectory
-
setSampleContext
Description copied from interface:SampleProcessor
Set sample context that this consumer should rely on.- Specified by:
setSampleContext
in interfaceSampleProcessor
- Overrides:
setSampleContext
in classAbstractSampleProcessor
- Parameters:
sampleContext
- the new sample context
-
setSampleConsumers
Sets the consumers- Parameters:
consumers
- for the samples (must not benull
)
-
addSampleConsumer
-
setSampleConsumer
-
removeSampleConsumer
-
setConsumedMetadata
Description copied from interface:SampleConsumer
Set the metadata of samples that will be consumed on the specified channel.- Specified by:
setConsumedMetadata
in interfaceSampleConsumer
- Parameters:
sampleMetadata
- The sample metadata that are being consumed for the associated channelchannel
- The channel whose sample metadata are being defined
-
getConsumedMetadata
-
getConsumedChannelCount
public int getConsumedChannelCount() -
setChannelAttribute
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 interfaceSampleProcessor
- Overrides:
setChannelAttribute
in classAbstractSampleProcessor
- Parameters:
channel
- The channel number to associate the attribute onkey
- The attribute keyvalue
- The attribute value to be set
-
setProducedMetadata
Description copied from interface:SampleProducer
Set the metadata associated with the specified channel- Specified by:
setProducedMetadata
in interfaceSampleProducer
- Parameters:
metadata
- The metadata to be associated to the specified channelchannel
- The channel whoses metadata are being associated with
-
getConsumer
-
startProducing
public void startProducing()Description copied from interface:SampleProducer
Start producing samples, must be invoked before any call toproduce()
- Specified by:
startProducing
in interfaceSampleProducer
-
produce
Description copied from interface:SampleProducer
Produce a single sample on the specified channel- Specified by:
produce
in interfaceSampleProducer
- Parameters:
s
- The sample producedchannel
- The channel on which is produced the sample
-
stopProducing
public void stopProducing()Description copied from interface:SampleProducer
Stop producing samples, noproduce()
call should occur after this service has been called.- Specified by:
stopProducing
in interfaceSampleProducer
-