abstract class AbstractValueInstrumentSample extends AbstractInstrumentSample implements org.apache.excalibur.instrument.manager.ValueInstrumentListener
| Modifier and Type | Field and Description |
|---|---|
protected int |
m_lastValue
Last value set to the sample for use for sample periods where no value is set.
|
protected int |
m_value
The sample value.
|
protected int |
m_valueCount
The number of times that the value has been changed in this sample period.
|
m_time| Modifier | Constructor and Description |
|---|---|
protected |
AbstractValueInstrumentSample(InstrumentProxy instrumentProxy,
java.lang.String name,
long interval,
int size,
java.lang.String description,
long lease)
Creates a new AbstractValueInstrumentSample
|
| 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 |
getValueInner()
Obtain the value of the sample.
|
protected void |
loadState(int value,
org.apache.avalon.framework.configuration.Configuration state)
Used to load the state, called from AbstractInstrumentSample.loadState();
|
void |
setValue(java.lang.String instrumentName,
int value,
long time)
Called by a ValueInstrument whenever its value is set.
|
protected abstract void |
setValueInner(int value,
long time)
Sets the current value of the sample.
|
protected void |
writeStateAttributes(java.io.PrintWriter out)
Allow subclasses to add information into the saved state.
|
addInstrumentSampleListener, expire, extendLease, getDescription, getDescriptor, getInstrumentProxy, getInterval, getLeaseExpirationTime, getName, getSize, getSnapshot, getStateVersion, getTime, getValue, isConfigured, loadState, makePermanent, removeInstrumentSampleListener, setConfigured, stateChanged, toString, update, updateListeners, writeStateenableLogging, getLogger, setupLogger, setupLogger, setupLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTypeprotected int m_value
protected int m_valueCount
protected int m_lastValue
protected AbstractValueInstrumentSample(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 final int getInstrumentType()
This InstrumentSample returns DefaultInstrumentManager.INSTRUMENT_TYPE_VALUE
getInstrumentType in interface InstrumentSamplepublic int getValueInner()
Should only be called when synchronized.
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 writeStateAttributes(java.io.PrintWriter out)
writeStateAttributes in class AbstractInstrumentSampleout - PrintWriter to write to.protected 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 setValue(java.lang.String instrumentName,
int value,
long time)
setValue in interface org.apache.excalibur.instrument.manager.ValueInstrumentListenerinstrumentName - The key of Instrument whose value was set.value - Value that was set.time - The time that the Instrument was incremented.
ValueInstrumentprotected abstract void setValueInner(int value,
long time)
value - New sample value.time - Time that the new sample arrives.