1 23 24 29 30 package com.sun.appserv.management.j2ee.statistics; 31 32 import java.util.Set ; 33 import java.util.Map ; 34 import java.io.Serializable ; 35 36 import javax.management.openmbean.CompositeData ; 37 38 import javax.management.j2ee.statistics.Statistic ; 39 import javax.management.j2ee.statistics.RangeStatistic ; 40 41 import com.sun.appserv.management.util.jmx.OpenMBeanUtil; 42 43 46 public class RangeStatisticImpl extends StatisticImpl 47 implements RangeStatistic , Serializable 48 { 49 static final long serialVersionUID = 6530146323113291603L; 50 51 52 private final long Current; 53 private final long HighWaterMark; 54 private final long LowWaterMark; 55 56 57 public 58 RangeStatisticImpl( 59 final String name, 60 final String description, 61 final String unit, 62 final long startTime, 63 final long lastSampleTime, 64 final long low, 65 final long current, 66 final long high ) 67 { 68 super( name, description, unit, startTime, lastSampleTime ); 69 70 if ( current < low || current > high ) 71 { 72 throw new IllegalArgumentException (); 73 } 74 75 Current = current; 76 HighWaterMark = high; 77 LowWaterMark = low; 78 } 79 80 public 81 RangeStatisticImpl( final CompositeData compositeData ) 82 { 83 this( OpenMBeanUtil.compositeDataToMap( compositeData ) ); 84 } 85 86 public 87 RangeStatisticImpl( final Map <String ,?> m ) 88 { 89 this( new MapStatisticImpl( m ) ); 90 } 91 92 public 93 RangeStatisticImpl( final RangeStatistic s ) 94 { 95 super( s ); 96 97 Current = s.getCurrent(); 98 LowWaterMark = s.getHighWaterMark(); 99 HighWaterMark = s.getLowWaterMark(); 100 } 101 102 103 public 104 RangeStatisticImpl( final MapStatistic s ) 105 { 106 super( s ); 107 108 Current = s.getlong( "Current" ); 109 LowWaterMark = s.getlong( "LowWaterMark" ); 110 HighWaterMark = s.getlong( "HighWaterMark" ); 111 } 112 113 114 public long 115 getCurrent() 116 { 117 return( Current ); 118 } 119 120 public long 121 getHighWaterMark() 122 { 123 return( HighWaterMark ); 124 } 125 126 public long 127 getLowWaterMark() 128 { 129 return( LowWaterMark ); 130 } 131 } 132 133 134 135 136 137 | Popular Tags |