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 TypeMethodDescriptionvoid
addInstrument
(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 providervoid
initializeInstrument
(Instrument instrument, Object context) Initializes an instrument within the provided context.void
initializeInstrument
(Instrument instrument, String options, Object context) Initializes an instrument within the provided options and context.boolean
Whether the instrumentation provider startedvoid
removeInstrumentByName
(String name) Removes an instrument instrumented by this provider by namevoid
setInstrument
(String instruments) Used to associate one or more instruments to a provider.void
setOptions
(String options) Sets configuration options for this providervoid
start()
Stops the instrumentation providervoid
startInstrument
(Instrument instrument) Starts an instrumentvoid
startInstruments
(InstrumentationLevel level, Object context) Starts all instruments of the specified instrumentation level and context.void
stop()
Starts the instrumentation providervoid
stopInstrument
(Instrument instrument) Stops an instrumentvoid
stopInstrument
(Instrument instrument, boolean force) Stops an instrument, forcing the stop, if necessary.void
stopInstruments
(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.
-