Interface InstrumentationProvider
- All Known Implementing Classes:
AbstractInstrumentationProvider,JMXProvider
public interface InstrumentationProvider
Pluggable instrumentation providers (ex. JMX) must implement this interface. It
provides methods for controlling the provider and the instruments instrumented
by the provider.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddInstrument(Instrument instrument) Adds an instrument to this providers list of managed instruments.Gets the configuration associated with the instrumentation providerReturns the string-based list of instruments directly configured by this provider via setInstrument.String[]Returns an string array of identifier to class name aliases for instruments known to the instrumentation provider.getInstrumentByName(String name) Returns an instrument instrumented by this provider by nameGets all instruments instrumented by this providerGets configuration options for this providervoidinitializeInstrument(Instrument instrument, Object context) Initializes an instrument within the provided context.voidinitializeInstrument(Instrument instrument, String options, Object context) Initializes an instrument within the provided options and context.booleanWhether the instrumentation provider startedvoidremoveInstrumentByName(String name) Removes an instrument instrumented by this provider by namevoidsetInstrument(String instruments) Used to associate one or more instruments to a provider.voidsetOptions(String options) Sets configuration options for this providervoidstart()Stops the instrumentation providervoidstartInstrument(Instrument instrument) Starts an instrumentvoidstartInstruments(InstrumentationLevel level, Object context) Starts all instruments of the specified instrumentation level and context.voidstop()Starts the instrumentation providervoidstopInstrument(Instrument instrument) Stops an instrumentvoidstopInstrument(Instrument instrument, boolean force) Stops an instrument, forcing the stop, if necessary.voidstopInstruments(InstrumentationLevel level, Object context) Stops all instruments of the specified instrumentation level and context.
-
Method Details
-
isStarted
boolean isStarted()Whether the instrumentation provider started- Returns:
- true if the provider is started
-
stop
void stop()Starts the instrumentation provider -
start
void start()Stops the instrumentation provider -
getConfiguration
Configuration getConfiguration()Gets the configuration associated with the instrumentation provider- Returns:
- the configuration associated with the provider
-
setInstrument
Used to associate one or more instruments to a provider. Instruments are specified by class name or alias. Multiple instruments must be specified as a comma separated list. example: DataCache,QueryCache,com.my.MyInstrument where DataCache and QueryCache have aliases and com.my.MyInstrument is a class implementing an Instrument.- Parameters:
instruments- one or more instrument class names or aliases
-
getInstrument
String getInstrument()Returns the string-based list of instruments directly configured by this provider via setInstrument. -
setOptions
Sets configuration options for this provider- Parameters:
options-
-
getOptions
String getOptions()Gets configuration options for this provider- Parameters:
options-
-
getInstrumentAliases
String[] getInstrumentAliases()Returns an string array of identifier to class name aliases for instruments known to the instrumentation provider. Example: {"DataCache", "org.apache.openjpa.instrumentation.DataCacheInstrument", "QueryCache", "org.apache.openjpa.instrumentation.QueryCacheInstrument"}- Returns:
- a string array of identifier, class name pairs.
-
addInstrument
Adds an instrument to this providers list of managed instruments. The instrument will participate in context-based lifecycle routines, depending on the instrumentation level.- Parameters:
instrument-
-
stopInstruments
Stops all instruments of the specified instrumentation level and context.- Parameters:
level- instrumentation levelcontext- instrumentation context (factory, broker, config)
-
startInstruments
Starts all instruments of the specified instrumentation level and context.- Parameters:
level- instrumentation levelcontext- instrumentation context (factory, broker, config)
-
initializeInstrument
Initializes an instrument within the provided context.- Parameters:
instrument- an instrumentcontext- instrumentation context (factory, broker, config)
-
initializeInstrument
Initializes an instrument within the provided options and context.- Parameters:
instrument- an instrumentoptions- configuration options to provide the instrument during initializationcontext- instrumentation context (factory, broker, config)
-
getInstrumentByName
Returns an instrument instrumented by this provider by name- Parameters:
name- the name of the instrument to return- Returns:
- the instrument or null if not instrumented by this provider
-
removeInstrumentByName
Removes an instrument instrumented by this provider by name- Parameters:
name- the name of the instrument to remove
-
getInstruments
Set<Instrument> getInstruments()Gets all instruments instrumented by this provider- Returns:
- instruments instrumented by this provider
-
startInstrument
Starts an instrument- Parameters:
instrument- this instrument to start
-
stopInstrument
Stops an instrument- Parameters:
instrument- the instrument to stop
-
stopInstrument
Stops an instrument, forcing the stop, if necessary.- Parameters:
instrument- the instrument to stopforce- forces the stop if the instrument does not stop gracefully.
-