1 18 package org.apache.activemq.management; 19 20 21 26 public class RangeStatisticImpl extends StatisticImpl { 27 private long highWaterMark; 28 private long lowWaterMark; 29 private long current; 30 31 public RangeStatisticImpl(String name, String unit, String description) { 32 super(name, unit, description); 33 } 34 35 public void reset() { 36 super.reset(); 37 current = 0; 38 lowWaterMark = 0; 39 highWaterMark = 0; 40 } 41 42 public long getHighWaterMark() { 43 return highWaterMark; 44 } 45 46 public long getLowWaterMark() { 47 return lowWaterMark; 48 } 49 50 public long getCurrent() { 51 return current; 52 } 53 54 public void setCurrent(long current) { 55 this.current = current; 56 if (current > highWaterMark) { 57 highWaterMark = current; 58 } 59 if (current < lowWaterMark || lowWaterMark == 0) { 60 lowWaterMark = current; 61 } 62 updateSampleTime(); 63 } 64 65 protected void appendFieldDescription(StringBuffer buffer) { 66 buffer.append(" current: "); 67 buffer.append(Long.toString(current)); 68 buffer.append(" lowWaterMark: "); 69 buffer.append(Long.toString(lowWaterMark)); 70 buffer.append(" highWaterMark: "); 71 buffer.append(Long.toString(highWaterMark)); 72 super.appendFieldDescription(buffer); 73 } 74 } 75 | Popular Tags |