1 /** 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 /** 4 * Licensed to the Apache Software Foundation (ASF) under one or more 5 * contributor license agreements. See the NOTICE file distributed with 6 * this work for additional information regarding copyright ownership. 7 * The ASF licenses this file to You under the Apache License, Version 2.0 8 * (the "License"); you may not use this file except in compliance with 9 * the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 21 package org.apache.geronimo.management.geronimo.stats; 22 23 import org.apache.geronimo.management.stats.CountStatisticImpl; 24 import org.apache.geronimo.management.stats.RangeStatisticImpl; 25 import org.apache.geronimo.management.stats.StatisticImpl; 26 import org.apache.geronimo.management.stats.TimeStatisticImpl; 27 import org.apache.geronimo.management.stats.StatsImpl; 28 import org.apache.geronimo.management.stats.WebConnectorStatsImpl; 29 30 import javax.management.j2ee.statistics.RangeStatistic; 31 import javax.management.j2ee.statistics.TimeStatistic; 32 import javax.management.j2ee.statistics.CountStatistic; 33 34 /** 35 * Jetty Web Connector class for JSR-77 stats. 36 */ 37 public class JettyWebConnectorStatsImpl extends WebConnectorStatsImpl implements JettyWebConnectorStats { 38 private CountStatisticImpl requestCount; 39 private TimeStatisticImpl connectionsDuration; 40 private RangeStatisticImpl connectionsRequest; 41 42 public JettyWebConnectorStatsImpl() { 43 requestCount = new CountStatisticImpl("Request Count", StatisticImpl.UNIT_COUNT, 44 "Total number of requests made to server", 0); 45 connectionsDuration = new TimeStatisticImpl("Connections Duration", StatisticImpl.UNIT_TIME_MILLISECOND, 46 "Duration of a connection"); 47 connectionsRequest = new RangeStatisticImpl("Connections Request", StatisticImpl.UNIT_COUNT, 48 "Range for connections requested during the observed period", 0); // all 0's 49 50 addStat("RequestCount", requestCount); 51 addStat("ConnectionsDuration", connectionsDuration); 52 addStat("ConnectionsRequest", connectionsRequest); 53 } 54 55 /** 56 * Gets the number of request count since statistics gathering started. 57 */ 58 public CountStatistic getRequestCount() { 59 return requestCount; 60 } 61 62 /** 63 * Gets the avg, min, max, and total connection duration time since 64 * statistics gathering started. 65 */ 66 public TimeStatistic getConnectionsDuration() { 67 return connectionsDuration; 68 } 69 70 /** 71 * Gets the min, max, current number of connection requests since statistics gathering started. 72 */ 73 public RangeStatistic getConnectionsRequest() { 74 return connectionsRequest; 75 } 76 77 /** 78 * Gets the number of request count since statistics gathering started. 79 */ 80 public CountStatisticImpl getRequestCountImpl() { 81 return requestCount; 82 } 83 84 /** 85 * Gets the count, min, max, and total connection duration time since 86 * statistics gathering started. The avg is total/count 87 */ 88 public TimeStatisticImpl getConnectionsDurationImpl() { 89 return connectionsDuration; 90 } 91 92 /** 93 * Gets the min, max, current number of connection requests since statistics gathering started. 94 */ 95 public RangeStatisticImpl getConnectionsRequestImpl() { 96 return connectionsRequest; 97 } 98 }