|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.excalibur.instrument.manager.InstrumentProxy
Instrumentables which do not implement ThreadSafe may have multiple instances created by the ComponentLocator. Each of these Instruments will share a common key and are profiled as a group. The InstrumentProxy is used make it easy for the InstrumentManager to control groups of Instruments as one.
The type of a Instrument can not be determined at configuration time. It is resolved when the Instrumentable actually registers the Instrument.
| Field Summary | |
private boolean |
m_configuredConfigured flag. |
private java.lang.String |
m_descriptionThe description of the Instrumente. |
private InstrumentDescriptorLocal |
m_descriptorThe Descriptor for the Instrument. |
private InstrumentableProxy |
m_instrumentableProxyThe InstrumentableProxy which owns the InstrumentProxy. |
private int |
m_lastValueThe most recent value set if this is a value instrument. |
private InstrumentListener[] |
m_listenersArray of registered Counter/ValueInstrumentListeners. |
private java.lang.String |
m_nameThe name used to identify a Instrument. |
private boolean |
m_registeredRegistered flag. |
private InstrumentSample[] |
m_sampleArrayOptimized array of the InstrumentSamples. |
private InstrumentSampleDescriptorLocal[] |
m_sampleDescriptorArrayOptimized array of the InstrumentSampleDescriptorLocals. |
private java.util.HashMap |
m_samplesMap of the maintained InstrumentSamples. |
private int |
m_stateVersionState Version. |
private int |
m_typeType of the Instrument |
private Logger |
m_valueLoggerChild logger to use for logging of new values. |
| Fields inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
|
| Constructor Summary | |
(package private) |
InstrumentProxy(InstrumentableProxy instrumentableProxy, java.lang.String name, java.lang.String description)Creates a new InstrumentProxy. |
| Method Summary | |
(package private) void |
addCounterInstrumentListener(CounterInstrumentListener listener)Adds a CounterInstrumentListener to the list of listeners which will receive updates of the value of the Instrument. |
private void |
addInstrumentListener(InstrumentListener listener)Common code to add a listener to the list of listeners which will receive updates of the value of the Instrument. |
private void |
addInstrumentSample(InstrumentSample instrumentSample)Add a InstrumentSample to the Instrument. |
(package private) void |
addValueInstrumentListener(ValueInstrumentListener listener)Adds a ValueInstrumentListener to the list of listeners which will receive updates of the value of the Instrument. |
void |
configure(Configuration configuration)Configures the Instrument. |
(package private) InstrumentSample |
createInstrumentSample(java.lang.String sampleDescription, long sampleInterval, int sampleSize, long sampleLease, int sampleType)Returns a InstrumentSampleDescriptorLocal based on its name. |
void |
enableLogging(Logger logger)Set the components logger. |
(package private) java.lang.String |
getDescription()Gets the description of the Instrument. |
(package private) InstrumentDescriptorLocal |
getDescriptor()Returns a Descriptor for the Instrument. |
(package private) InstrumentableProxy |
getInstrumentableProxy()Returns the InstrumentableProxy which owns the InstrumentProxy. |
(package private) InstrumentSample |
getInstrumentSample(java.lang.String InstrumentSampleName)Returns a InstrumentSample based on its name. |
(package private) InstrumentSampleDescriptorLocal[] |
getInstrumentSampleDescriptors()Returns an array of Descriptors for the InstrumentSamples in the Instrument. |
(package private) InstrumentSample[] |
getInstrumentSamples()Returns an array of the InstrumentSamples in the Instrument. |
(package private) java.lang.String |
getName()Gets the name for the Instrument. |
(package private) int |
getStateVersion()Returns the stateVersion of the instrument. |
(package private) int |
getType()Returns the type of the Instrument. |
static java.lang.String |
getTypeName(int type)Returns the name of a Instrument type. |
void |
increment(int count)Increments the Instrument by a specified count. |
boolean |
isActive()Used by classes being profiles so that they can avoid unnecessary code when the data from a Instrument is not being used. |
(package private) boolean |
isConfigured()Returns true if the Instrument was configured in the instrumentables section of the configuration. |
(package private) boolean |
isRegistered()Returns true if the Instrument was registered with the Instrument Manager. |
(package private) void |
loadState(Configuration state)Loads the state into the Instrument. |
(package private) void |
removeCounterInstrumentListener(CounterInstrumentListener listener)Removes a InstrumentListener from the list of listeners which will receive profile events. |
private void |
removeInstrumentListener(InstrumentListener listener)Common code to remove a listener from the list of listeners which will receive updates of the value of the Instrument. |
(package private) void |
removeInstrumentSample(InstrumentSample instrumentSample)Removes an InstrumentSample from the Instrument. |
(package private) void |
removeValueInstrumentListener(ValueInstrumentListener listener)Removes a InstrumentListener from the list of listeners which will receive profile events. |
(package private) Configuration |
saveState()Saves the current state into a Configuration. |
(package private) void |
setDescription(java.lang.String description)Sets the description for the Instrument. |
(package private) void |
setRegistered()Called by the InstrumentManager whenever an Instrument assigned to this proxy is registered. |
(package private) void |
setType(int type)Set the type of the Instrument. |
void |
setValue(int value)Sets the current value of the Instrument. |
protected void |
stateChanged()Called whenever the state of the instrument is changed. |
private InstrumentSample[] |
updateInstrumentSampleArray()Updates the cached array of InstrumentSamples taking synchronization into account. |
private InstrumentSampleDescriptorLocal[] |
updateInstrumentSampleDescriptorArray()Updates the cached array of InstrumentSampleDescriptorLocals taking synchronization into account. |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private InstrumentableProxy m_instrumentableProxy
private boolean m_configured
private boolean m_registered
private java.lang.String m_name
private java.lang.String m_description
private InstrumentDescriptorLocal m_descriptor
private int m_type
private InstrumentListener[] m_listeners
private java.util.HashMap m_samples
private InstrumentSample[] m_sampleArray
private InstrumentSampleDescriptorLocal[] m_sampleDescriptorArray
private Logger m_valueLogger
private int m_lastValue
private int m_stateVersion
| Constructor Detail |
InstrumentProxy(InstrumentableProxy instrumentableProxy,
java.lang.String name,
java.lang.String description)
instrumentableProxy - The InstrumentableProxy which owns the InstrumentProxy.name - The name used to identify a Instrumentable.description - The description of the the Instrumentable.| Method Detail |
public void enableLogging(Logger logger)
AbstractLogEnabledenableLogging in interface LogEnabledenableLogging in class AbstractLogEnabledlogger - the logger
public void configure(Configuration configuration)
throws ConfigurationException
configure in interface Configurableconfiguration - Instrument configuration element from the InstrumentManager's configuration.ConfigurationException - If there are any configuration problems.public boolean isActive()
isActive in interface InstrumentProxypublic void increment(int count)
increment in interface InstrumentProxycount - A positive integer to increment the counter by.public void setValue(int value)
setValue in interface InstrumentProxyvalue - The new value for the Instrument.InstrumentableProxy getInstrumentableProxy()
boolean isConfigured()
boolean isRegistered()
void setRegistered()
java.lang.String getName()
void setDescription(java.lang.String description)
description - The description of the Instrument.java.lang.String getDescription()
InstrumentDescriptorLocal getDescriptor()
void setType(int type)
type - Type of the Instrument.int getType()
void addCounterInstrumentListener(CounterInstrumentListener listener)
listener - CounterInstrumentListener which will start receiving profile updates.java.lang.IllegalStateException - If the Instrument's type is not InstrumentManager.INSTRUMENT_TYPE_COUNTER.void removeCounterInstrumentListener(CounterInstrumentListener listener)
listener - InstrumentListener which will stop receiving profile events.java.lang.IllegalStateException - If the Instrument's type is not InstrumentManager.INSTRUMENT_TYPE_COUNTER.void addValueInstrumentListener(ValueInstrumentListener listener)
listener - ValueInstrumentListener which will start receiving profile updates.java.lang.IllegalStateException - If the Instrument's type is not InstrumentManager.INSTRUMENT_TYPE_VALUE.void removeValueInstrumentListener(ValueInstrumentListener listener)
listener - InstrumentListener which will stop receiving profile events.java.lang.IllegalStateException - If the Instrument's type is not InstrumentManager.INSTRUMENT_TYPE_VALUE.private void addInstrumentSample(InstrumentSample instrumentSample)
void removeInstrumentSample(InstrumentSample instrumentSample)
InstrumentSample getInstrumentSample(java.lang.String InstrumentSampleName)
InstrumentSampleName - Name of the InstrumentSample being requested.InstrumentSample[] getInstrumentSamples()
InstrumentSample createInstrumentSample(java.lang.String sampleDescription,
long sampleInterval,
int sampleSize,
long sampleLease,
int sampleType)
sampleDescription - Description to assign to the new Sample.sampleInterval - Sample interval to use in the new Sample.sampleLease - Requested lease time for the new Sample in milliseconds. The InstrumentManager may grant a lease which is shorter or longer than the requested period.sampleType - Type of sample to request. Must be one of the following: InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_COUNTER, InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MINIMUM, InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MAXIMUM, InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MEAN.NoSuchInstrumentSampleException - If the specified InstrumentSample does not exist.InstrumentSampleDescriptorLocal[] getInstrumentSampleDescriptors()
int getStateVersion()
private void addInstrumentListener(InstrumentListener listener)
listener - InstrumentListener which will start receiving profile updates.private void removeInstrumentListener(InstrumentListener listener)
listener - InstrumentListener which will stop receiving profile updates.private InstrumentSample[] updateInstrumentSampleArray()
private InstrumentSampleDescriptorLocal[] updateInstrumentSampleDescriptorArray()
Configuration saveState()
void loadState(Configuration state)
throws ConfigurationException
state - Configuration object to load state from.ConfigurationException - If there were any problems loading the state.protected void stateChanged()
public static java.lang.String getTypeName(int type)
type - Type whose name is wanted.
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||