org.apache.excalibur.instrument.manager.impl
Class InstrumentProxy

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.excalibur.instrument.manager.impl.InstrumentProxy
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, org.apache.excalibur.instrument.InstrumentProxy, org.apache.avalon.framework.logger.LogEnabled

public class InstrumentProxy
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.excalibur.instrument.InstrumentProxy, org.apache.avalon.framework.configuration.Configurable

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 instrumented 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.

Since:
4.1
Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:25 $
Author:
Avalon Development Team

Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures the Instrument.
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
           
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 instrumented so that they can avoid unnecessary code when the data from a Instrument is not being used.
 void setValue(int value)
          Sets the current value of the Instrument.
protected  void stateChanged()
          Called whenever the state of the instrument is changed.
 
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
 

Method Detail

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configures the Instrument. Called from the InstrumentManager's configure method. The class does not need to be configured to function correctly.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration - Instrument configuration element from the InstrumentManager's configuration.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - If there are any configuration problems.

isActive

public boolean isActive()
Used by classes being instrumented so that they can avoid unnecessary code when the data from a Instrument is not being used.

Specified by:
isActive in interface org.apache.excalibur.instrument.InstrumentProxy

increment

public void increment(int count)
Increments the Instrument by a specified count. This method should be optimized to be extremely light weight when there are no registered CounterInstrumentListeners.

Specified by:
increment in interface org.apache.excalibur.instrument.InstrumentProxy
Parameters:
count - A positive integer to increment the counter by.

setValue

public void setValue(int value)
Sets the current value of the Instrument. This method is optimized to be extremely light weight when there are no registered ValueInstrumentListeners.

Specified by:
setValue in interface org.apache.excalibur.instrument.InstrumentProxy
Parameters:
value - The new value for the Instrument.

stateChanged

protected void stateChanged()
Called whenever the state of the instrument is changed.


getTypeName

public static java.lang.String getTypeName(int type)
Returns the name of a Instrument type.

Parameters:
type - Type whose name is wanted.
Returns:
The name of a Instrument type.


Copyright © 1997-2007 Apache Software Foundation. All Rights Reserved.