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.StatsImpl;
   22   
   23   /**
   24    * The J2EE Statistics for the Connection.
   25    * 
   26    * @version $Revision: 564057 $
   27    */
   28   public class ConnectionStatistics extends StatsImpl {
   29   
   30       private CountStatisticImpl enqueues;
   31       private CountStatisticImpl dequeues;
   32   
   33       public ConnectionStatistics() {
   34   
   35           enqueues = new CountStatisticImpl("enqueues", "The number of messages that have been sent to the connection");
   36           dequeues = new CountStatisticImpl("dequeues", "The number of messages that have been dispatched from the connection");
   37   
   38           addStatistic("enqueues", enqueues);
   39           addStatistic("dequeues", dequeues);
   40       }
   41   
   42       public CountStatisticImpl getEnqueues() {
   43           return enqueues;
   44       }
   45   
   46       public CountStatisticImpl getDequeues() {
   47           return dequeues;
   48       }
   49   
   50       public void reset() {
   51           super.reset();
   52           enqueues.reset();
   53           dequeues.reset();
   54       }
   55   
   56       public void setEnabled(boolean enabled) {
   57           super.setEnabled(enabled);
   58           enqueues.setEnabled(enabled);
   59           dequeues.setEnabled(enabled);
   60       }
   61   
   62       public void setParent(ConnectorStatistics parent) {
   63           if (parent != null) {
   64               enqueues.setParent(parent.getEnqueues());
   65               dequeues.setParent(parent.getDequeues());
   66           } else {
   67               enqueues.setParent(null);
   68               dequeues.setParent(null);
   69           }
   70       }
   71   
   72   }

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