1 4 package demo.jmx; 5 6 import java.text.SimpleDateFormat ; 7 import java.util.Date ; 8 9 12 public class HistoryData 13 { 14 private final long intervalStart; 15 16 private int counter; 17 18 public HistoryData(long intervalStart, int counter) 19 { 20 this.intervalStart = intervalStart; 21 this.counter = counter; 22 } 23 24 public long getIntervalStart() 25 { 26 return this.intervalStart; 27 } 28 29 public Date getTime() 30 { 31 return new Date (intervalStart); 32 } 33 34 public int getCounter() 35 { 36 return this.counter; 37 } 38 39 public void incrementCounter() 40 { 41 this.counter++; 42 } 43 44 public void update(int duration, String error) 45 { 46 this.counter++; 47 } 48 49 public String toString() 50 { 51 SimpleDateFormat df = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); 52 return df.format(new Date (intervalStart))+" : "+counter; 53 } 54 } 55 | Popular Tags |