KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > management > j2ee > statistics > JCAConnectionPoolStatsImpl


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.management.j2ee.statistics;
23
24 import javax.management.j2ee.statistics.BoundedRangeStatistic JavaDoc;
25 import javax.management.j2ee.statistics.CountStatistic JavaDoc;
26 import javax.management.j2ee.statistics.JCAConnectionPoolStats JavaDoc;
27 import javax.management.j2ee.statistics.RangeStatistic JavaDoc;
28 import javax.management.j2ee.statistics.TimeStatistic JavaDoc;
29
30 /**
31  * The JSR77.6.20 JCAConnectionPoolStats implementation
32  *
33  * @author Scott.Stark@jboss.org
34  * @version $Revision: 37459 $
35  */

36 public class JCAConnectionPoolStatsImpl extends JCAConnectionStatsImpl
37         implements JCAConnectionPoolStats JavaDoc
38 {
39    // Constants -----------------------------------------------------
40

41    /** @since 4.0.2 */
42    private static final long serialVersionUID = 6867747857618271195L;
43
44    // Constructors --------------------------------------------------
45

46    public JCAConnectionPoolStatsImpl(String JavaDoc cfName, String JavaDoc mcfName,
47                                      BoundedRangeStatistic JavaDoc freePoolSize, BoundedRangeStatistic JavaDoc poolSize)
48    {
49       this(cfName, mcfName, null, null, null, null, freePoolSize, poolSize, null);
50    }
51
52    public JCAConnectionPoolStatsImpl(String JavaDoc cfName, String JavaDoc mcfName,
53                                      TimeStatistic JavaDoc waitTime, TimeStatistic JavaDoc useTime, CountStatistic JavaDoc closeCount,
54                                      CountStatistic JavaDoc createCount, BoundedRangeStatistic JavaDoc freePoolSize,
55                                      BoundedRangeStatistic JavaDoc poolSize, RangeStatistic JavaDoc waitingThreadCount)
56    {
57       super(cfName, mcfName, waitTime, useTime);
58       if (closeCount == null)
59       {
60          closeCount = new CountStatisticImpl("CloseCount", "1",
61                  "The number of connection closes");
62       }
63       if (createCount == null)
64       {
65          createCount = new CountStatisticImpl("CreateCount", "1",
66                  "The number of connection creates");
67       }
68       if (waitingThreadCount == null)
69       {
70          waitingThreadCount = new RangeStatisticImpl("WaitingThreadCount",
71                  "1", "The number of threads waiting for a connection");
72       }
73       super.addStatistic("CloseCount", closeCount);
74       super.addStatistic("CreateCount", createCount);
75       super.addStatistic("FreePoolSize", freePoolSize);
76       super.addStatistic("PoolSize", poolSize);
77       super.addStatistic("WaitingThreadCount", waitingThreadCount);
78    }
79
80    public CountStatistic JavaDoc getCloseCount()
81    {
82       CountStatistic JavaDoc cs = (CountStatistic JavaDoc) getStatistic("CloseCount");
83       return cs;
84    }
85
86    public CountStatistic JavaDoc getCreateCount()
87    {
88       CountStatistic JavaDoc cs = (CountStatistic JavaDoc) getStatistic("CreateCount");
89       return cs;
90    }
91
92    public BoundedRangeStatistic JavaDoc getFreePoolSize()
93    {
94       BoundedRangeStatistic JavaDoc brs = (BoundedRangeStatistic JavaDoc) getStatistic("FreePoolSize");
95       return brs;
96    }
97
98    public BoundedRangeStatistic JavaDoc getPoolSize()
99    {
100       BoundedRangeStatistic JavaDoc brs = (BoundedRangeStatistic JavaDoc) getStatistic("PoolSize");
101       return brs;
102    }
103
104    public RangeStatistic JavaDoc getWaitingThreadCount()
105    {
106       RangeStatistic JavaDoc rs = (RangeStatistic JavaDoc) getStatistic("WaitingThreadCount");
107       return rs;
108    }
109 }
110
Popular Tags