001 /**002 * Licensed to the Apache Software Foundation (ASF) under one or more003 * contributor license agreements. See the NOTICE file distributed with004 * this work for additional information regarding copyright ownership.005 * The ASF licenses this file to You under the Apache License, Version 2.0006 * (the "License"); you may not use this file except in compliance with007 * the License. You may obtain a copy of the License at008 *009 * http://www.apache.org/licenses/LICENSE-2.0010 *011 * Unless required by applicable law or agreed to in writing, software012 * distributed under the License is distributed on an "AS IS" BASIS,013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.014 * See the License for the specific language governing permissions and015 * limitations under the License.016 */017018 package org.apache.activemq.broker.region;019020 import org.apache.activemq.management.CountStatisticImpl;021 import org.apache.activemq.management.StatsImpl;022023 /**024 * The J2EE Statistics for the Connection.025 * 026 * 027 */028 public class ConnectionStatistics extends StatsImpl {029030 private CountStatisticImpl enqueues;031 private CountStatisticImpl dequeues;032033 public ConnectionStatistics() {034035 enqueues = new CountStatisticImpl("enqueues", "The number of messages that have been sent to the connection");036 dequeues = new CountStatisticImpl("dequeues", "The number of messages that have been dispatched from the connection");037038 addStatistic("enqueues", enqueues);039 addStatistic("dequeues", dequeues);040 }041042 public CountStatisticImpl getEnqueues() {043 return enqueues;044 }045046 public CountStatisticImpl getDequeues() {047 return dequeues;048 }049050 public void reset() {051 super.reset();052 enqueues.reset();053 dequeues.reset();054 }055056 public void setEnabled(boolean enabled) {057 super.setEnabled(enabled);058 enqueues.setEnabled(enabled);059 dequeues.setEnabled(enabled);060 }061062 public void setParent(ConnectorStatistics parent) {063 if (parent != null) {064 enqueues.setParent(parent.getEnqueues());065 dequeues.setParent(parent.getDequeues());066 } else {067 enqueues.setParent(null);068 dequeues.setParent(null);069 }070 }071072 }