public abstract class AbstractMessageGenerator extends Object implements MessageGenerator
Message Senders
running
concurrently in threads
number of threads.Constructor and Description |
---|
AbstractMessageGenerator() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes and finalizes the generator.
|
abstract void |
generate()
Generates the messages.
|
int |
getActiveThreadsCount()
Gets the number of active threads in the internal executor service.
|
long |
getTasksInQueue()
Gets the number of sender tasks in the queue awaiting to be processed.
|
int |
getThreads()
Gets the number of threads that should be used to generate the messages.
|
void |
init(MessageSenderManager messageSenderManager,
List<MessageTemplate> messageStore)
Initializes the generator.
|
void |
interrupt(Exception exception)
Interrupts the execution with a message from failed sender.
|
boolean |
isFailFast()
Tells whether we should interrupt the generator immediately after a first error occurred.
|
void |
setCorrelator(Correlator correlator)
Sets a
Correlator to match requests and responses when a separate message channel is used for receiving responses. |
void |
setReportManager(ReportManager reportManager)
Sets the
ReportManager to be used for the current performance test execution. |
void |
setRunInfo(RunInfo runInfo)
Sets the current
RunInfo to control generating of the messages. |
void |
setSequenceManager(SequenceManager sequenceManager)
Configures the
SequenceManager to be used for the performance test execution. |
MessageGenerator |
setThreads(int threads)
Sets the number of threads used to generate the messages.
|
void |
setValidationManager(ValidationManager validationManager)
Configures the
ValidationManager to be used for the performance test execution. |
public void init(MessageSenderManager messageSenderManager, List<MessageTemplate> messageStore) throws PerfCakeException
messageSenderManager
is initialized as well.init
in interface MessageGenerator
messageSenderManager
- Message sender manager.messageStore
- Message store where the messages are taken from.PerfCakeException
- When it was not possible to initialize the generator.public void interrupt(Exception exception)
MessageGenerator
interrupt
in interface MessageGenerator
exception
- The cause of the interruption.public void setRunInfo(RunInfo runInfo)
RunInfo
to control generating of the messages.setRunInfo
in interface MessageGenerator
runInfo
- RunInfo
to be used.public void setReportManager(ReportManager reportManager)
ReportManager
to be used for the current performance test execution.setReportManager
in interface MessageGenerator
reportManager
- ReportManager
to be used.public void close() throws PerfCakeException
messageSenderManager
is closed as well.close
in interface MessageGenerator
PerfCakeException
- When it was not possible to smoothly finalize the generator.public abstract void generate() throws Exception
generate
in interface MessageGenerator
Exception
- When it was not possible to generate the messages.public int getThreads()
getThreads
in interface MessageGenerator
public MessageGenerator setThreads(int threads)
setThreads
in interface MessageGenerator
threads
- The number of threads to be used.public void setValidationManager(ValidationManager validationManager)
ValidationManager
to be used for the performance test execution.setValidationManager
in interface MessageGenerator
validationManager
- ValidationManager
to be used.public void setSequenceManager(SequenceManager sequenceManager)
SequenceManager
to be used for the performance test execution.setSequenceManager
in interface MessageGenerator
sequenceManager
- SequenceManager
to be used.public int getActiveThreadsCount()
getActiveThreadsCount
in interface MessageGenerator
public long getTasksInQueue()
MessageGenerator
getTasksInQueue
in interface MessageGenerator
public boolean isFailFast()
MessageGenerator
isFailFast
in interface MessageGenerator
perfcake.fail.fast
system property.public void setCorrelator(Correlator correlator)
MessageGenerator
Correlator
to match requests and responses when a separate message channel is used for receiving responses.
Null means that no correlator and no receiver is used.setCorrelator
in interface MessageGenerator
correlator
- The correlator to be used to match requests and responses.Copyright © 2010–2017 PerfCake Community. All rights reserved.