1 23 24 package com.sun.ejb.base.stats; 25 26 import javax.management.j2ee.statistics.CountStatistic ; 27 import javax.management.j2ee.statistics.BoundedRangeStatistic ; 28 29 import com.sun.enterprise.admin.monitor.stats.EJBCacheStats; 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.EJBCacheStatsProvider; 41 42 import java.util.logging.*; 43 import com.sun.enterprise.log.Log; 44 import com.sun.logging.*; 45 46 52 53 public class EJBCacheStatsImpl 54 extends StatsImpl 55 implements com.sun.enterprise.admin.monitor.stats.EJBCacheStats 56 { 57 private EJBCacheStatsProvider delegate; 58 59 private MutableBoundedRangeStatisticImpl cacheHits; 60 private MutableBoundedRangeStatisticImpl cacheMisses; 61 private MutableBoundedRangeStatisticImpl numBeans; 62 private MutableCountStatisticImpl expiredStat; 63 private MutableCountStatisticImpl passivationErrors; 64 private MutableCountStatisticImpl passivations; 65 private MutableCountStatisticImpl passivationSuccess; 66 67 68 public EJBCacheStatsImpl(EJBCacheStatsProvider delegate) { 69 this.delegate = delegate; 70 71 initialize(); 72 } 73 74 protected void initialize() { 75 super.initialize("com.sun.enterprise.admin.monitor.stats.EJBCacheStats"); 76 77 cacheHits = new MutableBoundedRangeStatisticImpl( 78 new BoundedRangeStatisticImpl("CacheHits")); 79 cacheMisses = new MutableBoundedRangeStatisticImpl( 80 new BoundedRangeStatisticImpl("CacheMisses")); 81 numBeans = new MutableBoundedRangeStatisticImpl( 82 new BoundedRangeStatisticImpl("NumBeansInCache", 83 "Count", 0, delegate.getMaxCacheSize(), 0)); 84 expiredStat = new MutableCountStatisticImpl( 85 new CountStatisticImpl("NumExpiredSessionsRemoved")); 86 passivationErrors = new MutableCountStatisticImpl( 87 new CountStatisticImpl("NumPassivationErrors")); 88 passivations = new MutableCountStatisticImpl( 89 new CountStatisticImpl("NumPassivations")); 90 passivationSuccess = new MutableCountStatisticImpl( 91 new CountStatisticImpl("NumPassivationSuccess")); 92 } 93 94 public BoundedRangeStatistic getCacheHits(){ 95 cacheHits.setCount(delegate.getCacheHits()); 96 return (BoundedRangeStatistic ) cacheHits.modifiableView(); 97 } 98 99 public BoundedRangeStatistic getCacheMisses(){ 100 cacheMisses.setCount(delegate.getCacheMisses()); 101 return (BoundedRangeStatistic ) cacheMisses.modifiableView(); 102 } 103 104 public BoundedRangeStatistic getNumBeansInCache(){ 105 numBeans.setCount(delegate.getNumBeansInCache()); 106 return (BoundedRangeStatistic ) numBeans.modifiableView(); 107 } 108 109 public CountStatistic getNumExpiredSessionsRemoved(){ 110 expiredStat.setCount(delegate.getNumExpiredSessionsRemoved()); 111 return (CountStatistic ) expiredStat.modifiableView(); 112 } 113 114 public CountStatistic getNumPassivationErrors(){ 115 passivationErrors.setCount(delegate.getNumPassivationErrors()); 116 return (CountStatistic ) passivationErrors.modifiableView(); 117 } 118 119 public CountStatistic getNumPassivations(){ 120 passivations.setCount(delegate.getNumPassivations()); 121 return (CountStatistic ) passivations.modifiableView(); 122 } 123 124 public CountStatistic getNumPassivationSuccess() { 125 passivationSuccess.setCount(delegate.getNumPassivationSuccess()); 126 return (CountStatistic ) passivationSuccess.modifiableView(); 127 } 128 129 } 130 | Popular Tags |