1 23 24 28 29 34 35 package com.sun.enterprise.admin.monitor.stats; 36 import javax.management.j2ee.statistics.CountStatistic ; 37 import com.sun.enterprise.util.i18n.StringManager; 38 39 46 47 public class CountStatisticImpl extends StatisticImpl implements CountStatistic { 48 49 private long count; 50 private static final StringManager localStrMgr = 51 StringManager.getManager(CountStatisticImpl.class); 52 53 64 public CountStatisticImpl(String name) { 65 this(name, DEFAULT_UNIT); 66 } 67 78 public CountStatisticImpl(String name, String unit) { 79 this(name, unit, DEFAULT_VALUE); 80 } 81 92 public CountStatisticImpl(String name, String unit, String desc) { 93 this(DEFAULT_VALUE, name, unit, desc, Util.getInitTime()[0], Util.getInitTime()[1]); 94 } 95 106 public CountStatisticImpl(String name, String unit, long value) { 107 this(value, name, unit, Util.getDescriptionFromName(name), Util.getInitTime()[0], Util.getInitTime()[1]); 108 } 109 110 118 public CountStatisticImpl(long countVal, String name, String unit, 119 String desc, long sampleTime, long startTime) { 120 121 super(name, unit, desc, startTime, sampleTime); 122 count = countVal; 123 } 124 125 129 public long getCount() { 130 return count; 131 } 132 133 private static class Util { 134 138 private static String getDescriptionFromName(String name) { 139 return (localStrMgr.getString("describes_string") + name); 140 } 141 142 146 private static long[] getInitTime() { 147 final long time = System.currentTimeMillis(); 148 return ( new long[]{time, time} ); 149 } 150 } 151 } 152 | Popular Tags |