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

java.lang.Object
  extended byorg.apache.excalibur.instrument.manager.impl.InstrumentSampleDescriptorImpl
All Implemented Interfaces:
InstrumentSampleDescriptor

public class InstrumentSampleDescriptorImpl
extends java.lang.Object
implements InstrumentSampleDescriptor

Describes an InstrumentSample and acts as a Proxy to protect the original InstrumentSample object.

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

Method Summary
 void addInstrumentSampleListener(InstrumentSampleListener listener)
          Registers a InstrumentSampleListener with a InstrumentSample given a name.
 long extendLease(long lease)
          Extends the lease to be lease milliseconds from the current time.
 java.lang.String getDescription()
          Returns the description of the sample.
 InstrumentDescriptor getInstrumentDescriptor()
          Returns a reference to the descriptor of the Instrument of the sample.
 int getInstrumentType()
          Returns the Type of the Instrument which can use the sample.
 long getInterval()
          Returns the sample interval.
 long getLeaseExpirationTime()
          Returns the time that the current lease expires.
 java.lang.String getName()
          Returns the name of the sample.
 int getSize()
          Returns the number of samples in the sample history.
 InstrumentSampleSnapshot getSnapshot()
          Obtains a static snapshot of the InstrumentSample.
 int getStateVersion()
          Returns the stateVersion of the sample.
 long getTime()
          Obtain the UNIX time of the beginning of the sample.
 int getType()
          Returns the type of the Instrument Sample.
 int getValue()
          Obtain the value of the sample.
 boolean isConfigured()
          Returns true if the InstrumentSample was configured in the instrumentables section of the configuration.
 void removeInstrumentSampleListener(InstrumentSampleListener listener)
          Unregisters a InstrumentSampleListener from a InstrumentSample given a name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isConfigured

public boolean isConfigured()
Returns true if the InstrumentSample was configured in the instrumentables section of the configuration.

Specified by:
isConfigured in interface InstrumentSampleDescriptor
Returns:
True if configured.

getName

public java.lang.String getName()
Returns the name of the sample.

Specified by:
getName in interface InstrumentSampleDescriptor
Returns:
The name of the sample.

getInterval

public long getInterval()
Returns the sample interval. The period of each sample in millisends.

Specified by:
getInterval in interface InstrumentSampleDescriptor
Returns:
The sample interval.

getSize

public int getSize()
Returns the number of samples in the sample history.

Specified by:
getSize in interface InstrumentSampleDescriptor
Returns:
The size of the sample history.

getDescription

public java.lang.String getDescription()
Returns the description of the sample.

Specified by:
getDescription in interface InstrumentSampleDescriptor
Returns:
The description of the sample.

getType

public int getType()
Returns the type of the Instrument Sample. Possible values include InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_COUNTER, InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MAXIMUM, InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MEAN, or InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MINIMUM.

Specified by:
getType in interface InstrumentSampleDescriptor
Returns:
The type of the Instrument Sample.

getValue

public int getValue()
Obtain the value of the sample. All samples are integers, so the profiled objects must measure quantity (numbers of items), rate (items/period), time in milliseconds, etc.

Specified by:
getValue in interface InstrumentSampleDescriptor
Returns:
The sample value.

getTime

public long getTime()
Obtain the UNIX time of the beginning of the sample.

Specified by:
getTime in interface InstrumentSampleDescriptor
Returns:
The UNIX time of the beginning of the sample.

getInstrumentType

public int getInstrumentType()
Returns the Type of the Instrument which can use the sample. This should be the same for all instances of a class.

Should be one of the following: InstrumentManager.PROFILE_POINT_TYPE_COUNTER or InstrumentManager.PROFILE_POINT_TYPE_VALUE

Specified by:
getInstrumentType in interface InstrumentSampleDescriptor
Returns:
The Type of the Instrument which can use the sample.

getInstrumentDescriptor

public InstrumentDescriptor getInstrumentDescriptor()
Returns a reference to the descriptor of the Instrument of the sample.

Specified by:
getInstrumentDescriptor in interface InstrumentSampleDescriptor
Returns:
A reference to the descriptor of the Instrument of the sample.

addInstrumentSampleListener

public void addInstrumentSampleListener(InstrumentSampleListener listener)
Registers a InstrumentSampleListener with a InstrumentSample given a name.

Specified by:
addInstrumentSampleListener in interface InstrumentSampleDescriptor
Parameters:
listener - The listener which should start receiving updates from the InstrumentSample.

removeInstrumentSampleListener

public void removeInstrumentSampleListener(InstrumentSampleListener listener)
Unregisters a InstrumentSampleListener from a InstrumentSample given a name.

Specified by:
removeInstrumentSampleListener in interface InstrumentSampleDescriptor
Parameters:
listener - The listener which should stop receiving updates from the InstrumentSample.

getLeaseExpirationTime

public long getLeaseExpirationTime()
Returns the time that the current lease expires. Permanent samples will return a value of 0.

Specified by:
getLeaseExpirationTime in interface InstrumentSampleDescriptor
Returns:
The time that the current lease expires.

extendLease

public long extendLease(long lease)
Extends the lease to be lease milliseconds from the current time.

Specified by:
extendLease in interface InstrumentSampleDescriptor
Parameters:
lease - The length of the lease in milliseconds.
Returns:
The new lease expiration time. Returns 0 if the sample is permanent.

getSnapshot

public InstrumentSampleSnapshot getSnapshot()
Obtains a static snapshot of the InstrumentSample.

Specified by:
getSnapshot in interface InstrumentSampleDescriptor
Returns:
A static snapshot of the InstrumentSample.

getStateVersion

public int getStateVersion()
Returns the stateVersion of the sample. The state version will be incremented each time any of the configuration of the sample is modified. Clients can use this value to tell whether or not anything has changed without having to do an exhaustive comparison.

Specified by:
getStateVersion in interface InstrumentSampleDescriptor
Returns:
The state version of the sample.


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