KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > base > stats > EntityBeanStatsImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.ejb.base.stats;
25
26 import javax.management.j2ee.statistics.EntityBeanStats JavaDoc;
27 import javax.management.j2ee.statistics.CountStatistic JavaDoc;
28 import javax.management.j2ee.statistics.RangeStatistic JavaDoc;
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 /**
47  * A Class for providing stats for Entity Container.
48  *
49  * @author Mahesh Kannan
50  */

51
52 public class EntityBeanStatsImpl
53     extends EJBStatsImpl
54     implements javax.management.j2ee.statistics.EntityBeanStats JavaDoc
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 JavaDoc getPooledCount() {
79     pooledCountStat.setCount(entityDelegate.getPooledCount());
80     return (RangeStatistic JavaDoc) pooledCountStat.modifiableView();
81     }
82
83     public RangeStatistic JavaDoc getReadyCount() {
84     readyCountStat.setCount(entityDelegate.getReadyCount());
85     return (RangeStatistic JavaDoc) readyCountStat.modifiableView();
86     }
87
88 }
89
Popular Tags