KickJava   Java API By Example, From Geeks To Geeks.

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


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.CountStatistic JavaDoc;
25 import javax.management.j2ee.statistics.JMSConsumerStats JavaDoc;
26 import javax.management.j2ee.statistics.JMSProducerStats JavaDoc;
27 import javax.management.j2ee.statistics.JMSSessionStats JavaDoc;
28 import javax.management.j2ee.statistics.TimeStatistic JavaDoc;
29
30
31 /**
32  * Represents the statistics provided by a JMS Session
33  *
34  * @author <a HREF="mailto:marc@jboss.org">Marc Fleury</a>
35  * @author Andreas Schaefer
36  * @version $Revision: 37459 $
37  */

38 public final class JMSSessionStatsImpl extends StatsBase
39         implements JMSSessionStats JavaDoc
40 {
41    // Constants -----------------------------------------------------
42

43    /** @since 4.0.2 */
44    private static final long serialVersionUID = 7614059976793609889L;
45    
46    // Attributes ----------------------------------------------------
47
private JMSProducerStats JavaDoc[] mProducers;
48    private JMSConsumerStats JavaDoc[] mConsumers;
49    private CountStatistic JavaDoc mMessageCount;
50    private CountStatistic JavaDoc mPendingMessageCount;
51    private CountStatistic JavaDoc mExpiredMessageCount;
52    private TimeStatistic JavaDoc mMessageWaitTime;
53    private CountStatistic JavaDoc mDurableSubscriptionCount;
54
55    // Constructors --------------------------------------------------
56

57    public JMSSessionStatsImpl(JMSProducerStats JavaDoc[] pProducers,
58                               JMSConsumerStats JavaDoc[] pConsumers,
59                               CountStatistic JavaDoc pMessageCount,
60                               CountStatistic JavaDoc pPendingMessageCount,
61                               CountStatistic JavaDoc pExpiredMessageCount,
62                               TimeStatistic JavaDoc pMessageWaitTime,
63                               CountStatistic JavaDoc pDurableSubscriptionCount)
64    {
65       mProducers = (pProducers != null ? pProducers : new JMSProducerStats JavaDoc[0]);
66       mConsumers = (pConsumers != null ? pConsumers : new JMSConsumerStats JavaDoc[0]);
67       mMessageCount = pMessageCount;
68       super.addStatistic("MessageCount", mMessageCount);
69       mPendingMessageCount = pPendingMessageCount;
70       super.addStatistic("PendingMessageCount", mPendingMessageCount);
71       mExpiredMessageCount = pExpiredMessageCount;
72       super.addStatistic("ExpiredMessageCount", mExpiredMessageCount);
73       mMessageWaitTime = pMessageWaitTime;
74       super.addStatistic("MessageWaitTime", mMessageWaitTime);
75       mDurableSubscriptionCount = pDurableSubscriptionCount;
76       super.addStatistic("DurableSubscriptionCount", mDurableSubscriptionCount);
77    }
78
79    // Public --------------------------------------------------------
80

81    // javax.management.j2ee.JMSConnectionStats implementation -------
82

83    public JMSProducerStats JavaDoc[] getProducers()
84    {
85       return mProducers;
86    }
87
88    public JMSConsumerStats JavaDoc[] getConsumers()
89    {
90       return mConsumers;
91    }
92
93    public CountStatistic JavaDoc getMessageCount()
94    {
95       return mMessageCount;
96    }
97
98    public CountStatistic JavaDoc getPendingMessageCount()
99    {
100       return mPendingMessageCount;
101    }
102
103    public CountStatistic JavaDoc getExpiredMessageCount()
104    {
105       return mExpiredMessageCount;
106    }
107
108    public TimeStatistic JavaDoc getMessageWaitTime()
109    {
110       return mMessageWaitTime;
111    }
112
113    public CountStatistic JavaDoc getDurableSubscriptionCount()
114    {
115       return mDurableSubscriptionCount;
116    }
117 }
118
Popular Tags