Methods Summary |
---|
public long | getCurrent()
return ( this.current );
|
public java.lang.String | getDescription()
return ( initial.getDescription());
|
public long | getHighWaterMark()
return ( this.highWaterMark );
|
public long | getLastSampleTime()
return ( this.lastSampleTime );
|
public long | getLowWaterMark()
return ( this.lowWaterMark );
|
public long | getLowerBound()
return ( initial.getLowerBound() );
|
public java.lang.String | getName()
return ( initial.getName() );
|
public long | getStartTime()
return ( initial.getStartTime() );
|
public java.lang.String | getUnit()
return ( initial.getUnit() );
|
public long | getUpperBound()
return ( initial.getUpperBound() );
|
public javax.management.j2ee.statistics.Statistic | modifiableView()
return ( this );
|
public void | reset()Resets to the initial state. It is guaranteed that following changes occur
to the statistic if this method is called:
- The current value is reset to initial value.
- The lastSampleTime is reset to current time in milliseconds.
- The startTime is reset to lastSampleTime.
- The highWaterMark is reset to the initial value.
- The lowWaterMark is reset to the initial value.
The remaining meta data in the encapsulated statistic is unchanged. The
upper and lower bounds are untouched.
this.current = initial.getCurrent();
this.lastSampleTime = System.currentTimeMillis();
this.startTime = this.lastSampleTime;
this.highWaterMark = initial.getHighWaterMark();
this.lowWaterMark = initial.getLowWaterMark();
|
public void | setCount(long current)Changes the current value of the encapsulated BoundedRangeStatistic to the given value.
Since this is the only mutator exposed here, here are the other side effects
of calling this method:
- lastSampleTime is set to current time in milliseconds.
- highWaterMark is accordingly adjusted.
- lowWaterMark is accordingly adjusted.
In a real-time system with actual probes for measurement, the lastSampleTime
could be different from the instant when this method is called, but that is deemed insignificant.
this.current = current;
this.lastSampleTime = System.currentTimeMillis();
this.lowWaterMark = (current < this.lowWaterMark) ? (current) : (this.lowWaterMark);
this.highWaterMark = (current > this.highWaterMark) ? (current) : (this.highWaterMark);
this.lastSampleTime = System.currentTimeMillis();
|
public void | setDescription(java.lang.String s)
try {
((StatisticImpl)this.initial).setDescription(s);
}
catch(final Exception e) {
}
|
public javax.management.j2ee.statistics.Statistic | unmodifiableView()This method is the essence of this class. It provides the read-only view of encapsulated
Statistic. If the clients have to know the Statistic, this is what should
be called by actual data collecting component to return the value to them.
The principle advantage is from the data collecting component's standpoint, in
that it does not have to create instances of BoundedRangeStatistic when its
current value is queried/measured.
return ( new BoundedRangeStatisticImpl(
this.current, // this is the actual changing statistic
this.highWaterMark, // highWaterMark may change per current
this.lowWaterMark, // lowWaterMark may change per current
initial.getUpperBound(), // upperBound is not designed to change
initial.getLowerBound(), // lowerBound is not designed to change
initial.getName(), // name does not change
initial.getUnit(), // unit does not change
initial.getDescription(), // description does not change
this.startTime, // changes if reset is called earlier
this.lastSampleTime // changes all the time!
));
|