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: */package org.apache.geronimo.management.geronimo.stats;
019:
020: import org.apache.geronimo.management.stats.CountStatisticImpl;
021: import org.apache.geronimo.management.stats.RangeStatisticImpl;
022: import org.apache.geronimo.management.stats.StatisticImpl;
023: import org.apache.geronimo.management.stats.TimeStatisticImpl;
024: import org.apache.geronimo.management.stats.StatsImpl;
025: import org.apache.geronimo.management.stats.WebConnectorStatsImpl;
026:
027: import javax.management.j2ee.statistics.RangeStatistic;
028: import javax.management.j2ee.statistics.TimeStatistic;
029: import javax.management.j2ee.statistics.CountStatistic;
030:
031: /**
032: * Jetty Web Connector class for JSR-77 stats.
033: */
034: public class JettyWebConnectorStatsImpl extends WebConnectorStatsImpl
035: implements JettyWebConnectorStats {
036: private CountStatisticImpl requestCount;
037: private TimeStatisticImpl connectionsDuration;
038: private RangeStatisticImpl connectionsRequest;
039:
040: public JettyWebConnectorStatsImpl() {
041: requestCount = new CountStatisticImpl("Request Count",
042: StatisticImpl.UNIT_COUNT,
043: "Total number of requests made to server", 0);
044: connectionsDuration = new TimeStatisticImpl(
045: "Connections Duration",
046: StatisticImpl.UNIT_TIME_MILLISECOND,
047: "Duration of a connection");
048: connectionsRequest = new RangeStatisticImpl(
049: "Connections Request",
050: StatisticImpl.UNIT_COUNT,
051: "Range for connections requested during the observed period",
052: 0); // all 0's
053:
054: addStat("RequestCount", requestCount);
055: addStat("ConnectionsDuration", connectionsDuration);
056: addStat("ConnectionsRequest", connectionsRequest);
057: }
058:
059: /**
060: * Gets the number of request count since statistics gathering started.
061: */
062: public CountStatistic getRequestCount() {
063: return requestCount;
064: }
065:
066: /**
067: * Gets the avg, min, max, and total connection duration time since
068: * statistics gathering started.
069: */
070: public TimeStatistic getConnectionsDuration() {
071: return connectionsDuration;
072: }
073:
074: /**
075: * Gets the min, max, current number of connection requests since statistics gathering started.
076: */
077: public RangeStatistic getConnectionsRequest() {
078: return connectionsRequest;
079: }
080:
081: /**
082: * Gets the number of request count since statistics gathering started.
083: */
084: public CountStatisticImpl getRequestCountImpl() {
085: return requestCount;
086: }
087:
088: /**
089: * Gets the count, min, max, and total connection duration time since
090: * statistics gathering started. The avg is total/count
091: */
092: public TimeStatisticImpl getConnectionsDurationImpl() {
093: return connectionsDuration;
094: }
095:
096: /**
097: * Gets the min, max, current number of connection requests since statistics gathering started.
098: */
099: public RangeStatisticImpl getConnectionsRequestImpl() {
100: return connectionsRequest;
101: }
102: }
|