Interface InstrumentationProvider
-
- All Known Implementing Classes:
AbstractInstrumentationProvider,JMXProvider
public interface InstrumentationProviderPluggable instrumentation providers (ex. JMX) must implement this interface. It provides methods for controlling the provider and the instruments instrumented by the provider.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddInstrument(Instrument instrument)Adds an instrument to this providers list of managed instruments.ConfigurationgetConfiguration()Gets the configuration associated with the instrumentation providerjava.lang.StringgetInstrument()Returns the string-based list of instruments directly configured by this provider via setInstrument.java.lang.String[]getInstrumentAliases()Returns an string array of identifier to class name aliases for instruments known to the instrumentation provider.InstrumentgetInstrumentByName(java.lang.String name)Returns an instrument instrumented by this provider by namejava.util.Set<Instrument>getInstruments()Gets all instruments instrumented by this providerjava.lang.StringgetOptions()Gets configuration options for this providervoidinitializeInstrument(Instrument instrument, java.lang.Object context)Initializes an instrument within the provided context.voidinitializeInstrument(Instrument instrument, java.lang.String options, java.lang.Object context)Initializes an instrument within the provided options and context.booleanisStarted()Whether the instrumentation provider startedvoidremoveInstrumentByName(java.lang.String name)Removes an instrument instrumented by this provider by namevoidsetInstrument(java.lang.String instruments)Used to associate one or more instruments to a provider.voidsetOptions(java.lang.String options)Sets configuration options for this providervoidstart()Stops the instrumentation providervoidstartInstrument(Instrument instrument)Starts an instrumentvoidstartInstruments(InstrumentationLevel level, java.lang.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, java.lang.Object context)Stops all instruments of the specified instrumentation level and context.
-
-
-
Method Detail
-
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
void setInstrument(java.lang.String instruments)
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
java.lang.String getInstrument()
Returns the string-based list of instruments directly configured by this provider via setInstrument.
-
setOptions
void setOptions(java.lang.String options)
Sets configuration options for this provider- Parameters:
options-
-
getOptions
java.lang.String getOptions()
Gets configuration options for this provider- Parameters:
options-
-
getInstrumentAliases
java.lang.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
void addInstrument(Instrument instrument)
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
void stopInstruments(InstrumentationLevel level, java.lang.Object context)
Stops all instruments of the specified instrumentation level and context.- Parameters:
level- instrumentation levelcontext- instrumentation context (factory, broker, config)
-
startInstruments
void startInstruments(InstrumentationLevel level, java.lang.Object context)
Starts all instruments of the specified instrumentation level and context.- Parameters:
level- instrumentation levelcontext- instrumentation context (factory, broker, config)
-
initializeInstrument
void initializeInstrument(Instrument instrument, java.lang.Object context)
Initializes an instrument within the provided context.- Parameters:
instrument- an instrumentcontext- instrumentation context (factory, broker, config)
-
initializeInstrument
void initializeInstrument(Instrument instrument, java.lang.String options, java.lang.Object context)
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
Instrument getInstrumentByName(java.lang.String name)
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
void removeInstrumentByName(java.lang.String name)
Removes an instrument instrumented by this provider by name- Parameters:
name- the name of the instrument to remove
-
getInstruments
java.util.Set<Instrument> getInstruments()
Gets all instruments instrumented by this provider- Returns:
- instruments instrumented by this provider
-
startInstrument
void startInstrument(Instrument instrument)
Starts an instrument- Parameters:
instrument- this instrument to start
-
stopInstrument
void stopInstrument(Instrument instrument)
Stops an instrument- Parameters:
instrument- the instrument to stop
-
stopInstrument
void stopInstrument(Instrument instrument, boolean force)
Stops an instrument, forcing the stop, if necessary.- Parameters:
instrument- the instrument to stopforce- forces the stop if the instrument does not stop gracefully.
-
-