|
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.AbstractInstrumentSample
org.apache.excalibur.instrument.manager.CounterInstrumentSample
A InstrumentSample which stores the number of times that increment has been called during the sample period.
| Field Summary | |
protected int |
m_countThe count. |
protected long |
m_timeThe UNIX time of the beginning of the sample. |
| Fields inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
|
| Constructor Summary | |
(package private) |
CounterInstrumentSample(InstrumentProxy instrumentProxy, java.lang.String name, long interval, int size, java.lang.String description, long lease)Creates a new CounterInstrumentSample |
| Method Summary | |
void |
addInstrumentSampleListener(InstrumentSampleListener listener)Registers a InstrumentSampleListener with a InstrumentSample given a name. |
protected void |
advanceToNextSample()The current sample has already been stored. |
void |
expire()Tells the sample that its lease has expired. |
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. |
InstrumentSampleDescriptorLocal |
getDescriptor()Returns a Descriptor for the InstrumentSample. |
InstrumentProxy |
getInstrumentProxy()Returns the InstrumentProxy which owns the InstrumentSample. |
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. |
int |
getValueInner()Obtain the value of the sample. |
private void |
increment(int count, long time)Increments the count. |
void |
increment(java.lang.String instrumentName, int count, long time)Called by a CounterInstrument whenever its value is incremented. |
boolean |
isConfigured()Returns true if the Instrument was configured in the instrumentables section of the configuration. |
void |
loadState(Configuration state)Loads the state into the InstrumentSample. |
protected void |
loadState(int value, Configuration state)Used to load the state, called from AbstractInstrumentSample.loadState(); |
protected void |
postSaveNeedsReset()Called after a state is loaded if the sample period is not the same as the last period saved. |
void |
removeInstrumentSampleListener(InstrumentSampleListener listener)Unregisters a InstrumentSampleListener from a InstrumentSample given a name. |
Configuration |
saveState()Saves the current state into a Configuration. |
protected void |
saveState(DefaultConfiguration state)Allow subclasses to add information into the saved state. |
(package private) void |
setConfigured()Sets the configured flag. |
protected void |
stateChanged()Called whenever the state of the sample is changed. |
java.lang.String |
toString()Returns a string representation of the sample. |
protected boolean |
update(long time)Brings the InstrumentSample's time up to date so that a new value can be added. |
protected void |
updateListeners(int value, long time)Notifies any listeners of a change. |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled |
enableLogging |
| Field Detail |
protected int m_count
protected long m_time
| Constructor Detail |
CounterInstrumentSample(InstrumentProxy instrumentProxy,
java.lang.String name,
long interval,
int size,
java.lang.String description,
long lease)
instrumentProxy - The InstrumentProxy which owns the InstrumentSample.name - The name of the new InstrumentSample.interval - The sample interval of the new InstrumentSample.size - The number of samples to store as history. Assumes that size is at least 1.description - The description of the new InstrumentSample.lease - The length of the lease in milliseconds.| Method Detail |
public int getType()
getType in interface InstrumentSamplepublic final int getInstrumentType()
This InstrumentSample returns InstrumentManager.PROFILE_POINT_TYPE_COUNTER
getInstrumentType in interface InstrumentSamplepublic int getValueInner()
getValueInner in class AbstractInstrumentSampleprotected void advanceToNextSample()
Should only be called when synchronized.
advanceToNextSample in class AbstractInstrumentSample
protected void loadState(int value,
Configuration state)
throws ConfigurationException
Should only be called when synchronized.
loadState in class AbstractInstrumentSamplevalue - Current value loaded from the state.state - Configuration object to load state from.ConfigurationException - If there were any problems loading the state.protected void postSaveNeedsReset()
postSaveNeedsReset in class AbstractInstrumentSample
public void increment(java.lang.String instrumentName,
int count,
long time)
increment in interface CounterInstrumentListenerinstrumentName - The name of Instrument which was incremented.count - A positive integer to increment the counter by.time - The time that the Instrument was incremented.
private void increment(int count,
long time)
time - Time that the count is incremented.count - A positive integer to increment the counter by.public InstrumentProxy getInstrumentProxy()
getInstrumentProxy in interface InstrumentSamplepublic boolean isConfigured()
isConfigured in interface InstrumentSamplepublic final java.lang.String getName()
getName in interface InstrumentSamplepublic final long getInterval()
getInterval in interface InstrumentSamplepublic final int getSize()
getSize in interface InstrumentSamplepublic final java.lang.String getDescription()
getDescription in interface InstrumentSamplepublic InstrumentSampleDescriptorLocal getDescriptor()
getDescriptor in interface InstrumentSamplepublic final int getValue()
getValue in interface InstrumentSamplepublic final long getTime()
getTime in interface InstrumentSamplepublic long getLeaseExpirationTime()
getLeaseExpirationTime in interface InstrumentSamplepublic long extendLease(long lease)
extendLease in interface InstrumentSamplelease - The length of the lease in milliseconds.public void expire()
expire in interface InstrumentSamplepublic final InstrumentSampleSnapshot getSnapshot()
getSnapshot in interface InstrumentSamplepublic int getStateVersion()
getStateVersion in interface InstrumentSamplepublic void addInstrumentSampleListener(InstrumentSampleListener listener)
addInstrumentSampleListener in interface InstrumentSamplelistener - The listener which should start receiving updates from the InstrumentSample.public void removeInstrumentSampleListener(InstrumentSampleListener listener)
removeInstrumentSampleListener in interface InstrumentSamplelistener - The listener which should stop receiving updates from the InstrumentSample.
protected void updateListeners(int value,
long time)
Make sure that this is called OUTSIDE of a synchrinization block.
value - The new value.time - The time that the new value was set.public final Configuration saveState()
saveState in interface InstrumentSample
public final void loadState(Configuration state)
throws ConfigurationException
loadState in interface InstrumentSamplestate - Configuration object to load state from.ConfigurationException - If there were any problems loading the state.void setConfigured()
protected void saveState(DefaultConfiguration state)
state - State configuration.protected boolean update(long time)
Should only be called when synchronized.
time - The time to which the InstrumentSample should be brought up to date.protected void stateChanged()
public java.lang.String toString()
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||