KickJava   Java API By Example, From Geeks To Geeks.

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


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.CountStatistic JavaDoc;
27 import javax.management.j2ee.statistics.EJBStats JavaDoc;
28
29 import com.sun.enterprise.admin.monitor.stats.CountStatisticImpl;
30 import com.sun.enterprise.admin.monitor.stats.MutableCountStatisticImpl;
31
32 import com.sun.ejb.spi.stats.EJBStatsProvider;
33
34 /**
35  * A Class for providing stats for EJB Container
36  * All S1AS(EJB)Containers act as the provider
37  *
38  * @author Mahesh Kannan
39  */

40
41 public abstract class EJBStatsImpl
42     extends StatsImpl
43     implements javax.management.j2ee.statistics.EJBStats JavaDoc
44 {
45     protected EJBStatsProvider delegate;
46
47     private MutableCountStatisticImpl createStat;
48     private MutableCountStatisticImpl removeStat;
49
50     public EJBStatsImpl(EJBStatsProvider delegate, String JavaDoc intfName) {
51     this.delegate = delegate;
52     super.initialize(intfName);
53
54     initStats();
55     }
56
57     private void initStats() {
58     createStat = new MutableCountStatisticImpl(
59         new CountStatisticImpl("CreateCount"));
60     removeStat = new MutableCountStatisticImpl(
61         new CountStatisticImpl("RemoveCount"));
62     }
63
64     public CountStatistic JavaDoc getCreateCount(){
65     createStat.setCount(delegate.getCreateCount());
66     return (CountStatistic JavaDoc) createStat.modifiableView();
67     }
68
69     public CountStatistic JavaDoc getRemoveCount(){
70     removeStat.setCount(delegate.getRemoveCount());
71     return (CountStatistic JavaDoc) removeStat.modifiableView();
72     }
73
74 }
75
Popular Tags