1 23 24 29 30 package com.sun.appserv.management.j2ee.statistics; 31 32 import java.util.Map ; 33 import java.io.Serializable ; 34 35 import javax.management.openmbean.CompositeData ; 36 37 import javax.management.j2ee.statistics.Statistic ; 38 import javax.management.j2ee.statistics.CountStatistic ; 39 40 import com.sun.appserv.management.util.jmx.OpenMBeanUtil; 41 import com.sun.appserv.management.util.misc.ObjectUtil; 42 43 44 47 public class CountStatisticImpl extends StatisticImpl 48 implements CountStatistic , Serializable 49 { 50 static final long serialVersionUID = -4868791714488583778L; 51 52 53 private final long Count; 54 55 public 56 CountStatisticImpl( 57 final String name, 58 final String description, 59 final String unit, 60 final long startTime, 61 final long lastSampleTime, 62 final long count ) 63 { 64 super( name, description, unit, startTime, lastSampleTime ); 65 Count = count; 66 } 67 68 public 69 CountStatisticImpl( final CompositeData compositeData ) 70 { 71 this( OpenMBeanUtil.compositeDataToMap( compositeData ) ); 72 } 73 74 public 75 CountStatisticImpl( final CountStatistic s ) 76 { 77 super( s ); 78 Count = s.getCount(); 79 } 80 81 public 82 CountStatisticImpl( final MapStatistic s ) 83 { 84 super( s ); 85 Count = s.getlong( "Count" ); 86 } 87 88 public 89 CountStatisticImpl( final Map <String ,?> data ) 90 { 91 this( new MapStatisticImpl( data ) ); 92 } 93 94 95 public long 96 getCount() 97 { 98 return( Count ); 99 } 100 101 public int 102 hashCode() 103 { 104 return super.hashCode() ^ ObjectUtil.hashCode( Count ); 105 } 106 107 108 public boolean 109 equals( final Object rhs ) 110 { 111 boolean equals = super.equals( rhs ) && (rhs instanceof CountStatistic ); 112 113 if ( equals ) 114 { 115 final CountStatistic s = (CountStatistic )rhs; 116 117 equals = getCount() == s.getCount(); 118 } 119 return( equals ); 120 } 121 } 122 123 124 125 126 127 | Popular Tags |