org.apache.excalibur.instrument
Class ValueInstrument

java.lang.Object
  extended byorg.apache.excalibur.instrument.AbstractInstrument
      extended byorg.apache.excalibur.instrument.ValueInstrument
All Implemented Interfaces:
Instrument

public class ValueInstrument
extends AbstractInstrument

Objects implementing Instrumentable can create Instruments with integer values using a ValueInstrument. ValueInstruments are perfect for profiling things like system memory, or the size of a pool or cache.

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

Constructor Summary
ValueInstrument(java.lang.String name)
          Creates a new ValueInstrument.
 
Method Summary
 void setValue(int value)
          Sets the current value of the Instrument.
 
Methods inherited from class org.apache.excalibur.instrument.AbstractInstrument
getInstrumentName, getInstrumentProxy, isActive, setInstrumentProxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueInstrument

public ValueInstrument(java.lang.String name)
Creates a new ValueInstrument.

Parameters:
name - The name of the Instrument. The value should be a string which does not contain spaces or periods.
Method Detail

setValue

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

Note that in many cases is best to call this method even if the isActive() method returns false. This is because the InstrumentManager will remember the last value set and use it if the instrument ever becomes active. For things like pool sizes which do not change often, this behavior is critical so that users can begin monitoring the value and see what it was before they connected. Setting the value is very light weight, but its calculation may not be. It is up to the user to weigh the benefits and consequences one way or the other.

Parameters:
value - The new value for the Instrument.


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.