1 23 24 package com.sun.ejb.base.stats; 25 26 import javax.management.j2ee.statistics.CountStatistic ; 27 import javax.management.j2ee.statistics.TimeStatistic ; 28 import javax.management.j2ee.statistics.BoundedRangeStatistic ; 29 30 import com.sun.enterprise.admin.monitor.stats.EJBPoolStats; 31 import com.sun.enterprise.admin.monitor.stats.CountStatisticImpl; 32 import com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl; 33 import com.sun.enterprise.admin.monitor.stats.BoundedRangeStatisticImpl; 34 import com.sun.enterprise.admin.monitor.stats.MutableBoundedRangeStatisticImpl; 35 36 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistry; 37 import com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener; 38 import com.sun.enterprise.admin.monitor.registry.MonitoringLevel; 39 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistrationException; 40 41 import com.sun.enterprise.admin.monitor.stats.EJBPoolStats; 42 import com.sun.ejb.spi.stats.EJBPoolStatsProvider; 43 44 import java.util.logging.*; 45 import com.sun.enterprise.log.Log; 46 import com.sun.logging.*; 47 48 54 55 public class EJBPoolStatsImpl 56 extends StatsImpl 57 implements com.sun.enterprise.admin.monitor.stats.EJBPoolStats 58 { 59 private EJBPoolStatsProvider delegate; 60 61 private MutableCountStatisticImpl jmsStat; 62 private MutableBoundedRangeStatisticImpl beansInPoolStat; 63 private MutableBoundedRangeStatisticImpl threadStat; 64 private MutableCountStatisticImpl createdStat; 65 private MutableCountStatisticImpl destroyedStat; 66 67 public EJBPoolStatsImpl(EJBPoolStatsProvider delegate) { 68 this.delegate = delegate; 69 70 initialize(); 71 } 72 73 protected void initialize() { 74 super.initialize("com.sun.enterprise.admin.monitor.stats.EJBPoolStats"); 75 76 jmsStat = new MutableCountStatisticImpl( 77 new CountStatisticImpl("JmsMaxMessagesLoad")); 78 beansInPoolStat = new MutableBoundedRangeStatisticImpl( 79 new BoundedRangeStatisticImpl("NumBeansInPool", 80 "Count", 0, delegate.getMaxPoolSize(), 81 delegate.getSteadyPoolSize())); 82 threadStat = new MutableBoundedRangeStatisticImpl( 83 new BoundedRangeStatisticImpl("NumThreadsWaiting")); 84 createdStat = new MutableCountStatisticImpl( 85 new CountStatisticImpl("TotalBeansCreated")); 86 destroyedStat = new MutableCountStatisticImpl( 87 new CountStatisticImpl("TotalBeansDestroyed")); 88 } 89 90 public CountStatistic getJmsMaxMessagesLoad() { 91 jmsStat.setCount(delegate.getJmsMaxMessagesLoad()); 92 return (CountStatistic ) jmsStat.modifiableView(); 93 } 94 95 public BoundedRangeStatistic getNumBeansInPool() { 96 beansInPoolStat.setCount(delegate.getNumBeansInPool()); 97 return (BoundedRangeStatistic ) beansInPoolStat.modifiableView(); 98 } 99 100 public BoundedRangeStatistic getNumThreadsWaiting() { 101 threadStat.setCount(delegate.getNumThreadsWaiting()); 102 return (BoundedRangeStatistic ) threadStat.modifiableView(); 103 } 104 105 public CountStatistic getTotalBeansCreated() { 106 createdStat.setCount(delegate.getTotalBeansCreated()); 107 return (CountStatistic ) createdStat.modifiableView(); 108 } 109 110 public CountStatistic getTotalBeansDestroyed() { 111 destroyedStat.setCount(delegate.getTotalBeansDestroyed()); 112 return (CountStatistic ) destroyedStat.modifiableView(); 113 } 114 115 } 116 | Popular Tags |