class CounterInstrumentSample extends AbstractInstrumentSample implements org.apache.excalibur.instrument.manager.CounterInstrumentListener
| Modifier and Type | Field and Description |
|---|---|
protected int |
m_count
The count.
|
m_time| Constructor and Description |
|---|
CounterInstrumentSample(InstrumentProxy instrumentProxy,
java.lang.String name,
long interval,
int size,
java.lang.String description,
long lease)
Creates a new CounterInstrumentSample
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
advanceToNextSample(boolean reset)
The current sample has already been stored.
|
protected int |
getFillValue()
Returns the value to use for filling in the buffer when time is skipped.
|
int |
getInstrumentType()
Returns the Type of the Instrument which can use the sample.
|
int |
getType()
Returns the type of the Instrument 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.
|
protected void |
loadState(int value,
org.apache.avalon.framework.configuration.Configuration state)
Used to load the state, called from AbstractInstrumentSample.loadState();
|
addInstrumentSampleListener, expire, extendLease, getDescription, getDescriptor, getInstrumentProxy, getInterval, getLeaseExpirationTime, getName, getSize, getSnapshot, getStateVersion, getTime, getValue, isConfigured, loadState, makePermanent, removeInstrumentSampleListener, setConfigured, stateChanged, toString, update, updateListeners, writeState, writeStateAttributesenableLogging, getLogger, setupLogger, setupLogger, setupLoggerCounterInstrumentSample(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.public int getType()
getType in interface InstrumentSamplepublic final int getInstrumentType()
This InstrumentSample returns DefaultInstrumentManager.INSTRUMENT_TYPE_COUNTER
getInstrumentType in interface InstrumentSamplepublic int getValueInner()
getValueInner in class AbstractInstrumentSampleprotected void advanceToNextSample(boolean reset)
Should only be called when synchronized.
advanceToNextSample in class AbstractInstrumentSamplereset - True if the next sample should be reset.protected int getFillValue()
Should only be called when synchronized.
getFillValue in class AbstractInstrumentSampleprotected void loadState(int value,
org.apache.avalon.framework.configuration.Configuration state)
throws org.apache.avalon.framework.configuration.ConfigurationException
Should only be called when synchronized.
loadState in class AbstractInstrumentSamplevalue - Current value loaded from the state.state - Configuration object to load state from.org.apache.avalon.framework.configuration.ConfigurationException - If there were any problems loading the
state.public void increment(java.lang.String instrumentName,
int count,
long time)
increment in interface org.apache.excalibur.instrument.manager.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.