Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » broker » region » [javadoc | source]
    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   
   18   package org.apache.activemq.broker.region;
   19   
   20   import org.apache.activemq.management.CountStatisticImpl;
   21   import org.apache.activemq.management.PollCountStatisticImpl;
   22   import org.apache.activemq.management.StatsImpl;
   23   import org.apache.activemq.management.TimeStatisticImpl;
   24   
   25   /**
   26    * The J2EE Statistics for the a Destination.
   27    * 
   28    * @version $Revision$
   29    */
   30   public class DestinationStatistics extends StatsImpl {
   31   
   32       protected CountStatisticImpl enqueues;
   33       protected CountStatisticImpl dequeues;
   34       protected CountStatisticImpl consumers;
   35       protected CountStatisticImpl producers;
   36       protected CountStatisticImpl messages;
   37       protected PollCountStatisticImpl messagesCached;
   38       protected CountStatisticImpl dispatched;
   39       protected CountStatisticImpl inflight;
   40       protected CountStatisticImpl expired;
   41       protected TimeStatisticImpl processTime;
   42   
   43       public DestinationStatistics() {
   44   
   45           enqueues = new CountStatisticImpl("enqueues", "The number of messages that have been sent to the destination");
   46           dispatched = new CountStatisticImpl("dispatched", "The number of messages that have been dispatched from the destination");
   47           dequeues = new CountStatisticImpl("dequeues", "The number of messages that have been acknowledged from the destination");
   48           inflight = new CountStatisticImpl("inflight", "The number of messages dispatched but awaiting acknowledgement");
   49           expired = new CountStatisticImpl("expired", "The number of messages that have expired");
   50           
   51           consumers = new CountStatisticImpl("consumers", "The number of consumers that that are subscribing to messages from the destination");
   52           consumers.setDoReset(false);
   53           producers = new CountStatisticImpl("producers", "The number of producers that that are publishing messages to the destination");
   54           producers.setDoReset(false);
   55           messages = new CountStatisticImpl("messages", "The number of messages that that are being held by the destination");
   56           messagesCached = new PollCountStatisticImpl("messagesCached", "The number of messages that are held in the destination's memory cache");
   57           processTime = new TimeStatisticImpl("processTime", "information around length of time messages are held by a destination");
   58           addStatistic("enqueues", enqueues);
   59           addStatistic("dispatched", dispatched);
   60           addStatistic("dequeues", dequeues);
   61           addStatistic("inflight", inflight);
   62           addStatistic("expired", expired);  
   63           addStatistic("consumers", consumers);
   64           addStatistic("producers", producers);
   65           addStatistic("messages", messages);
   66           addStatistic("messagesCached", messagesCached);
   67           addStatistic("processTime", processTime);
   68       }
   69   
   70       public CountStatisticImpl getEnqueues() {
   71           return enqueues;
   72       }
   73   
   74       public CountStatisticImpl getDequeues() {
   75           return dequeues;
   76       }
   77       
   78       public CountStatisticImpl getInflight() {
   79           return inflight;
   80       }
   81   
   82       public CountStatisticImpl getExpired() {
   83           return expired;
   84       }
   85   
   86       public CountStatisticImpl getConsumers() {
   87           return consumers;
   88       }
   89       
   90       public CountStatisticImpl getProducers() {
   91           return producers;
   92       }
   93   
   94       public PollCountStatisticImpl getMessagesCached() {
   95           return messagesCached;
   96       }
   97   
   98       public CountStatisticImpl getMessages() {
   99           return messages;
  100       }
  101   
  102       public void setMessagesCached(PollCountStatisticImpl messagesCached) {
  103           this.messagesCached = messagesCached;
  104       }
  105   
  106       public CountStatisticImpl getDispatched() {
  107           return dispatched;
  108       }
  109   
  110       public TimeStatisticImpl getProcessTime() {
  111           return this.processTime;
  112       }
  113   
  114       public void reset() {
  115           if (this.isDoReset()) {
  116               super.reset();
  117               enqueues.reset();
  118               dequeues.reset();
  119               dispatched.reset();
  120               inflight.reset();
  121               expired.reset();
  122           }
  123       }
  124   
  125       public void setEnabled(boolean enabled) {
  126           super.setEnabled(enabled);
  127           enqueues.setEnabled(enabled);
  128           dispatched.setEnabled(enabled);
  129           dequeues.setEnabled(enabled);
  130           inflight.setEnabled(enabled);
  131           expired.setEnabled(true);
  132           consumers.setEnabled(enabled);
  133           producers.setEnabled(enabled);
  134           messages.setEnabled(enabled);
  135           messagesCached.setEnabled(enabled);
  136           processTime.setEnabled(enabled);
  137   
  138       }
  139   
  140       public void setParent(DestinationStatistics parent) {
  141           if (parent != null) {
  142               enqueues.setParent(parent.enqueues);
  143               dispatched.setParent(parent.dispatched);
  144               dequeues.setParent(parent.dequeues);
  145               inflight.setParent(parent.inflight);
  146               expired.setParent(parent.expired);
  147               consumers.setParent(parent.consumers);
  148               producers.setParent(parent.producers);
  149               messagesCached.setParent(parent.messagesCached);
  150               messages.setParent(parent.messages);
  151               processTime.setParent(parent.processTime);
  152           } else {
  153               enqueues.setParent(null);
  154               dispatched.setParent(null);
  155               dequeues.setParent(null);
  156               inflight.setParent(null);
  157               expired.setParent(null);
  158               consumers.setParent(null);
  159               producers.setParent(null);
  160               messagesCached.setParent(null);
  161               messages.setParent(null);
  162               processTime.setParent(null);
  163           }
  164       }
  165   
  166   }

Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » broker » region » [javadoc | source]