001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 /** 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with 006 * this work for additional information regarding copyright ownership. 007 * The ASF licenses this file to You under the Apache License, Version 2.0 008 * (the "License"); you may not use this file except in compliance with 009 * the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019 020 021 package org.apache.geronimo.management.geronimo.stats; 022 023 import org.apache.geronimo.management.stats.CountStatisticImpl; 024 import org.apache.geronimo.management.stats.RangeStatisticImpl; 025 import org.apache.geronimo.management.stats.StatisticImpl; 026 import org.apache.geronimo.management.stats.TimeStatisticImpl; 027 import org.apache.geronimo.management.stats.StatsImpl; 028 import org.apache.geronimo.management.stats.WebConnectorStatsImpl; 029 030 import javax.management.j2ee.statistics.RangeStatistic; 031 import javax.management.j2ee.statistics.TimeStatistic; 032 import javax.management.j2ee.statistics.CountStatistic; 033 034 /** 035 * Jetty Web Connector class for JSR-77 stats. 036 */ 037 public class JettyWebConnectorStatsImpl extends WebConnectorStatsImpl implements JettyWebConnectorStats { 038 private CountStatisticImpl requestCount; 039 private TimeStatisticImpl connectionsDuration; 040 private RangeStatisticImpl connectionsRequest; 041 042 public JettyWebConnectorStatsImpl() { 043 requestCount = new CountStatisticImpl("Request Count", StatisticImpl.UNIT_COUNT, 044 "Total number of requests made to server", 0); 045 connectionsDuration = new TimeStatisticImpl("Connections Duration", StatisticImpl.UNIT_TIME_MILLISECOND, 046 "Duration of a connection"); 047 connectionsRequest = new RangeStatisticImpl("Connections Request", StatisticImpl.UNIT_COUNT, 048 "Range for connections requested during the observed period", 0); // all 0's 049 050 addStat("RequestCount", requestCount); 051 addStat("ConnectionsDuration", connectionsDuration); 052 addStat("ConnectionsRequest", connectionsRequest); 053 } 054 055 /** 056 * Gets the number of request count since statistics gathering started. 057 */ 058 public CountStatistic getRequestCount() { 059 return requestCount; 060 } 061 062 /** 063 * Gets the avg, min, max, and total connection duration time since 064 * statistics gathering started. 065 */ 066 public TimeStatistic getConnectionsDuration() { 067 return connectionsDuration; 068 } 069 070 /** 071 * Gets the min, max, current number of connection requests since statistics gathering started. 072 */ 073 public RangeStatistic getConnectionsRequest() { 074 return connectionsRequest; 075 } 076 077 /** 078 * Gets the number of request count since statistics gathering started. 079 */ 080 public CountStatisticImpl getRequestCountImpl() { 081 return requestCount; 082 } 083 084 /** 085 * Gets the count, min, max, and total connection duration time since 086 * statistics gathering started. The avg is total/count 087 */ 088 public TimeStatisticImpl getConnectionsDurationImpl() { 089 return connectionsDuration; 090 } 091 092 /** 093 * Gets the min, max, current number of connection requests since statistics gathering started. 094 */ 095 public RangeStatisticImpl getConnectionsRequestImpl() { 096 return connectionsRequest; 097 } 098 }