1 23 24 28 29 34 35 package com.sun.enterprise.admin.monitor.stats; 36 import javax.management.j2ee.statistics.TimeStatistic ; 37 import com.sun.enterprise.util.i18n.StringManager; 38 39 45 46 public class TimeStatisticImpl extends StatisticImpl implements TimeStatistic { 47 48 private final long count; 49 private final long maxTime; 50 private final long minTime; 51 private final long totTime; 52 private static final StringManager localStrMgr = 53 StringManager.getManager(TimeStatisticImpl.class); 54 55 56 public TimeStatisticImpl(String name) { 57 this(name, StatisticImpl.DEFAULT_UNIT); 58 } 59 public TimeStatisticImpl(String name, String unit) { 60 this(StatisticImpl.DEFAULT_VALUE, StatisticImpl.DEFAULT_VALUE, 61 StatisticImpl.DEFAULT_VALUE, StatisticImpl.DEFAULT_VALUE, name, unit, 62 Util.getDescriptionFromName(name), Util.getInitTime()[0], Util.getInitTime()[1]); 63 } 64 65 70 public TimeStatisticImpl(String name, String unit, String desc) { 71 this(StatisticImpl.DEFAULT_VALUE, StatisticImpl.DEFAULT_VALUE, 72 StatisticImpl.DEFAULT_VALUE, StatisticImpl.DEFAULT_VALUE, name, unit, 73 desc, Util.getInitTime()[0], Util.getInitTime()[1]); 74 75 } 76 77 96 public TimeStatisticImpl(long counter, long maximumTime, long minimumTime, 97 long totalTime, String name, String unit, 98 String desc, long startTime, long sampleTime) { 99 100 super(name, unit, desc, startTime, sampleTime); 101 count = counter; 102 maxTime = maximumTime; 103 minTime = minimumTime; 104 totTime = totalTime; 105 } 106 107 111 public long getCount() { 112 return count; 113 } 114 115 120 public long getMaxTime() { 121 return maxTime; 122 } 123 124 129 public long getMinTime() { 130 return minTime; 131 } 132 133 138 public long getTotalTime() { 139 return totTime; 140 } 141 142 private static class Util { 143 147 private static String getDescriptionFromName(String name) { 148 return (localStrMgr.getString("describes_string") + name); 149 } 150 151 155 private static long[] getInitTime() { 156 final long time = System.currentTimeMillis(); 157 return ( new long[]{time, time} ); 158 } 159 } 160 } 161 | Popular Tags |