public class ExperimentRunner extends Object
RunnableExperiment
s and automatically creating
and populating the context of the experiments.
Usage notes: Much of the collection of data for building the
ExperimentContext
works through dynamic byte code augmentation
performed by the ExperimentAgent
. On most JVMs the agent will be
loaded dynamically at runtime on the first call to a method on the
ExperimentAgent
class. However, the Java byte code for a class can
only be augmented before the class is loaded, so it is important
that the ExperimentRunner
is used before any classes for the experiment
are used for the first time. If this is not possible, you can manually
initialise the ExperimentAgent
by calling ExperimentAgent.initialise()
at the earliest possible point in your code (i.e. the first line of a main method).
Also, bear in mind that your main class (and its superclasses) will not be passed
to the agent for augmentation as they will already be loaded.
Implementation notes: The ExperimentRunner
can only run a
single experiment at a time. This is because global static objects and variables
must be used to track the state of a running experiment. It is however safe for an
experiment to make use of multiple threads for the experiments execution.
Modifier and Type | Method and Description |
---|---|
static ExperimentContext |
runExperiment(RunnableExperiment experiment)
Run an experiment, filling in the context of the experiment as
it runs.
|
public static ExperimentContext runExperiment(RunnableExperiment experiment)
experiment
- the experiment to run