1 23 24 package com.sun.ejb.base.stats; 25 26 import javax.management.j2ee.statistics.EntityBeanStats ; 27 import javax.management.j2ee.statistics.CountStatistic ; 28 import javax.management.j2ee.statistics.RangeStatistic ; 29 30 import com.sun.enterprise.admin.monitor.stats.CountStatisticImpl; 31 import com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl; 32 import com.sun.enterprise.admin.monitor.stats.BoundedRangeStatisticImpl; 33 import com.sun.enterprise.admin.monitor.stats.MutableBoundedRangeStatisticImpl; 34 35 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistry; 36 import com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener; 37 import com.sun.enterprise.admin.monitor.registry.MonitoringLevel; 38 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistrationException; 39 40 import com.sun.ejb.spi.stats.EntityBeanStatsProvider; 41 42 import java.util.logging.*; 43 import com.sun.enterprise.log.Log; 44 import com.sun.logging.*; 45 46 51 52 public class EntityBeanStatsImpl 53 extends EJBStatsImpl 54 implements javax.management.j2ee.statistics.EntityBeanStats 55 { 56 protected EntityBeanStatsProvider entityDelegate; 57 58 private MutableBoundedRangeStatisticImpl pooledCountStat; 59 private MutableBoundedRangeStatisticImpl readyCountStat; 60 61 public EntityBeanStatsImpl(EntityBeanStatsProvider delegate) { 62 super(delegate, "javax.management.j2ee.statistics.EntityBeanStats"); 63 this.entityDelegate = delegate; 64 65 initStats(); 66 } 67 68 private void initStats() { 69 pooledCountStat = new MutableBoundedRangeStatisticImpl( 70 new BoundedRangeStatisticImpl("PooledCount", 71 "Count", 0, entityDelegate.getMaxPoolSize(), 72 entityDelegate.getSteadyPoolSize())); 73 readyCountStat = new MutableBoundedRangeStatisticImpl( 74 new BoundedRangeStatisticImpl("ReadyCount", 75 "Count", 0, entityDelegate.getMaxCacheSize(), 0)); 76 } 77 78 public RangeStatistic getPooledCount() { 79 pooledCountStat.setCount(entityDelegate.getPooledCount()); 80 return (RangeStatistic ) pooledCountStat.modifiableView(); 81 } 82 83 public RangeStatistic getReadyCount() { 84 readyCountStat.setCount(entityDelegate.getReadyCount()); 85 return (RangeStatistic ) readyCountStat.modifiableView(); 86 } 87 88 } 89 | Popular Tags |