KickJava   Java API By Example, From Geeks To Geeks.

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


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.SessionBeanStats 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
41 import com.sun.ejb.spi.stats.SessionBeanStatsProvider;
42
43 import java.util.logging.*;
44 import com.sun.enterprise.log.Log;
45 import com.sun.logging.*;
46
47 /**
48  * A Class for providing stats for both Stateless and Stateful Containers.
49  *
50  * @author Mahesh Kannan
51  */

52
53 public abstract class SessionBeanStatsImpl
54     extends EJBStatsImpl
55     implements javax.management.j2ee.statistics.SessionBeanStats JavaDoc
56 {
57     protected SessionBeanStatsProvider sessionDelegate;
58
59     private MutableBoundedRangeStatisticImpl methodReadyCountStat;
60
61     public SessionBeanStatsImpl(SessionBeanStatsProvider delegate, String JavaDoc intfName) {
62     super(delegate, intfName);
63     this.sessionDelegate = delegate;
64     }
65
66     protected void initSessionStats() {
67     methodReadyCountStat = new MutableBoundedRangeStatisticImpl(
68         new BoundedRangeStatisticImpl("MethodReadyCount",
69         "Count", 0, getMaxReadyCount(), getMinReadyCount()));
70     }
71
72     public RangeStatistic JavaDoc getMethodReadyCount() {
73     methodReadyCountStat.setCount(sessionDelegate.getMethodReadyCount());
74     return (RangeStatistic JavaDoc) methodReadyCountStat.modifiableView();
75     }
76
77     protected abstract int getMaxReadyCount();
78
79     protected abstract int getMinReadyCount();
80 }
81
Popular Tags