001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.management.j2ee.statistics;
023:
024: import javax.management.j2ee.statistics.CountStatistic;
025: import javax.management.j2ee.statistics.JMSConsumerStats;
026: import javax.management.j2ee.statistics.JMSProducerStats;
027: import javax.management.j2ee.statistics.JMSSessionStats;
028: import javax.management.j2ee.statistics.TimeStatistic;
029:
030: /**
031: * Represents the statistics provided by a JMS Session
032: *
033: * @author <a href="mailto:marc@jboss.org">Marc Fleury</a>
034: * @author Andreas Schaefer
035: * @version $Revision: 57197 $
036: */
037: public final class JMSSessionStatsImpl extends StatsBase implements
038: JMSSessionStats {
039: // Constants -----------------------------------------------------
040:
041: /** @since 4.0.2 */
042: private static final long serialVersionUID = 7614059976793609889L;
043:
044: // Attributes ----------------------------------------------------
045: private JMSProducerStats[] mProducers;
046: private JMSConsumerStats[] mConsumers;
047: private CountStatistic mMessageCount;
048: private CountStatistic mPendingMessageCount;
049: private CountStatistic mExpiredMessageCount;
050: private TimeStatistic mMessageWaitTime;
051: private CountStatistic mDurableSubscriptionCount;
052:
053: // Constructors --------------------------------------------------
054:
055: public JMSSessionStatsImpl(JMSProducerStats[] pProducers,
056: JMSConsumerStats[] pConsumers,
057: CountStatistic pMessageCount,
058: CountStatistic pPendingMessageCount,
059: CountStatistic pExpiredMessageCount,
060: TimeStatistic pMessageWaitTime,
061: CountStatistic pDurableSubscriptionCount) {
062: mProducers = (pProducers != null ? pProducers
063: : new JMSProducerStats[0]);
064: mConsumers = (pConsumers != null ? pConsumers
065: : new JMSConsumerStats[0]);
066: mMessageCount = pMessageCount;
067: super .addStatistic("MessageCount", mMessageCount);
068: mPendingMessageCount = pPendingMessageCount;
069: super .addStatistic("PendingMessageCount", mPendingMessageCount);
070: mExpiredMessageCount = pExpiredMessageCount;
071: super .addStatistic("ExpiredMessageCount", mExpiredMessageCount);
072: mMessageWaitTime = pMessageWaitTime;
073: super .addStatistic("MessageWaitTime", mMessageWaitTime);
074: mDurableSubscriptionCount = pDurableSubscriptionCount;
075: super .addStatistic("DurableSubscriptionCount",
076: mDurableSubscriptionCount);
077: }
078:
079: // Public --------------------------------------------------------
080:
081: // javax.management.j2ee.JMSConnectionStats implementation -------
082:
083: public JMSProducerStats[] getProducers() {
084: return mProducers;
085: }
086:
087: public JMSConsumerStats[] getConsumers() {
088: return mConsumers;
089: }
090:
091: public CountStatistic getMessageCount() {
092: return mMessageCount;
093: }
094:
095: public CountStatistic getPendingMessageCount() {
096: return mPendingMessageCount;
097: }
098:
099: public CountStatistic getExpiredMessageCount() {
100: return mExpiredMessageCount;
101: }
102:
103: public TimeStatistic getMessageWaitTime() {
104: return mMessageWaitTime;
105: }
106:
107: public CountStatistic getDurableSubscriptionCount() {
108: return mDurableSubscriptionCount;
109: }
110: }
|