1 23 24 25 package com.sun.appserv.management.j2ee.statistics; 26 27 import java.util.Map ; 28 import java.io.Serializable ; 29 30 import javax.management.openmbean.CompositeData ; 31 32 import com.sun.appserv.management.util.jmx.OpenMBeanUtil; 33 34 import com.sun.appserv.management.j2ee.statistics.StatisticImpl; 35 36 39 public final class NumberStatisticImpl 40 extends StatisticImpl implements NumberStatistic, Serializable { 41 static final long serialVersionUID = 2090185734375468533L; 42 43 private Number Current; 44 45 public NumberStatisticImpl( final CompositeData compositeData ) { 46 this( OpenMBeanUtil.compositeDataToMap( compositeData ) ); 47 } 48 49 public NumberStatisticImpl( final Map <String ,?> m ) { 50 this( new MapStatisticImpl( m ) ); 51 } 52 53 public NumberStatisticImpl( final NumberStatistic n ) { 54 super( n ); 55 Current = n.getCurrent(); 56 } 57 58 public NumberStatisticImpl( final MapStatistic m ) { 59 super( m ); 60 Current = (Number )m.getValue( "Current" ); 61 } 62 63 public NumberStatisticImpl( 64 final String name, 65 final String description, 66 final String unit, 67 final long startTime, 68 final long lastSampleTime, 69 final Number current ) { 70 super( name, description, unit, startTime, lastSampleTime ); 71 this.Current = current; 72 } 73 74 public void setNumber(Number c) { 75 this.Current = c; 76 this.mLastSampleTime = System.currentTimeMillis(); 77 } 78 79 public Number getCurrent() { 80 return( Current ); 81 } 82 } 83 84 85 86 87 88 | Popular Tags |