org.apache.excalibur.instrument.manager
Interface InstrumentSampleDescriptor

All Known Implementing Classes:
InstrumentSampleDescriptorImpl

public interface InstrumentSampleDescriptor

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

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.
 

Method Detail

isConfigured

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

Returns:
True if configured.

getName

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

Returns:
The name of the sample.

getInterval

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

Returns:
The sample interval.

getSize

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

Returns:
The size of the sample history.

getDescription

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

Returns:
The description of the sample.

getType

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

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.

Returns:
The sample value.

getTime

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

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

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.

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.

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.

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.

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.

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.

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.

Returns:
The state version of the sample.


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