|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.performance.LoadGenerator
public abstract class LoadGenerator
Base class for load / peformance test runners.
Uses Commons Digester to parse and load configuration and spawns
ClientThread instances to generate load and gather statistics.
Subclasses must implement makeClientThread to
create client thread instances to be kicked off by execute.
Sublasses will also in general override configure to load
additional configuration parameters and pass them on to the client in
makeClientThread. Implementations of configure
should start with a super() call so that the base configuration
parameters are loaded. This method should also set the configFile
property to a valid URI or filespec (suitable argument for Digester's parse
method). Setup code that needs to be executed before any client threads are
spawned should be put in init
See
DBCPSoak and its
sample configuration file for an example. As in that example, additional
sections of the config file should be parsed and loaded in the overridden
configure method. The "run" section is required by the base
implementation. That example also illustrates how init
can be used to set up resources or data structures required by the client
threads.
| Field Summary | |
|---|---|
protected java.lang.String |
configFile
|
protected java.lang.String |
cycleType
|
protected java.lang.String |
delayType
|
protected org.apache.commons.digester.Digester |
digester
|
protected static java.util.logging.Logger |
logger
logger |
protected long |
maxDelay
|
protected long |
minDelay
|
protected long |
peakPeriod
|
protected long |
rampPeriod
|
protected java.lang.String |
rampType
|
protected double |
sigma
|
protected long |
troughPeriod
|
| Constructor Summary | |
|---|---|
LoadGenerator()
|
|
| Method Summary | |
|---|---|
protected void |
configure()
Starts preparing Digester to parse the configuration file, pushing *this onto the stack and loading rules to configure basic "run" parameters. |
void |
configureRun(java.lang.String iterations,
java.lang.String clients,
java.lang.String minDelay,
java.lang.String maxDelay,
java.lang.String sigma,
java.lang.String delayType,
java.lang.String rampType,
java.lang.String rampPeriod,
java.lang.String peakPeriod,
java.lang.String troughPeriod,
java.lang.String cycleType)
|
void |
execute()
Invokes configure() to load digester rules, then digster.parse,
then init() to initialize configuration members. |
java.lang.String |
getConfigFile()
|
org.apache.commons.digester.Digester |
getDigester()
|
Statistics |
getStatistics()
|
protected void |
init()
This method is invoked by execute() after configure()
and digester parse, just before client threads are created. |
protected abstract ClientThread |
makeClientThread(long iterations,
long minDelay,
long maxDelay,
double sigma,
java.lang.String delayType,
long rampPeriod,
long peakPeriod,
long troughPeriod,
java.lang.String cycleType,
java.lang.String rampType,
java.util.logging.Logger logger,
Statistics stats)
|
protected void |
parseConfigFile()
|
void |
setConfigFile(java.lang.String configFile)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.util.logging.Logger logger
protected long minDelay
protected long maxDelay
protected double sigma
protected java.lang.String delayType
protected java.lang.String rampType
protected long rampPeriod
protected long peakPeriod
protected long troughPeriod
protected java.lang.String cycleType
protected org.apache.commons.digester.Digester digester
protected java.lang.String configFile
| Constructor Detail |
|---|
public LoadGenerator()
| Method Detail |
|---|
public void execute()
throws java.lang.Exception
Invokes configure() to load digester rules, then digster.parse,
then init() to initialize configuration members. Then spawns and
executes numClients ClientThreads using makeClientThread(long, long, long, double, java.lang.String, long, long, long, java.lang.String, java.lang.String, java.util.logging.Logger, org.apache.commons.performance.Statistics)
to create the ClientThread instances.
Subclasses should not need to override this method, but must implement makeClientThread and may override configure and init to prepare data to pass to makeClientThread.
java.lang.Exception
protected abstract ClientThread makeClientThread(long iterations,
long minDelay,
long maxDelay,
double sigma,
java.lang.String delayType,
long rampPeriod,
long peakPeriod,
long troughPeriod,
java.lang.String cycleType,
java.lang.String rampType,
java.util.logging.Logger logger,
Statistics stats)
protected void init()
throws java.lang.Exception
execute() after configure()
and digester parse, just before client threads are created. Objects that
need to be created and passed to client threads using configuration info
parsed from the config file should be created in this method.
java.lang.Exception
public void configureRun(java.lang.String iterations,
java.lang.String clients,
java.lang.String minDelay,
java.lang.String maxDelay,
java.lang.String sigma,
java.lang.String delayType,
java.lang.String rampType,
java.lang.String rampPeriod,
java.lang.String peakPeriod,
java.lang.String troughPeriod,
java.lang.String cycleType)
throws ConfigurationException
ConfigurationException
protected void configure()
throws java.lang.Exception
Starts preparing Digester to parse the configuration file, pushing *this onto the stack and loading rules to configure basic "run" parameters.
Subclasses can override this, using super() to load base
parameters and then adding additional addCallMethod
sequences for additional parameters.
java.lang.Exception
protected void parseConfigFile()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getConfigFile()
public void setConfigFile(java.lang.String configFile)
configFile - the configFile to setpublic org.apache.commons.digester.Digester getDigester()
public Statistics getStatistics()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||