1 // ======================================================================== 2 // Copyright 2009-2009 Mort Bay Consulting Pty. Ltd. 3 // ------------------------------------------------------------------------ 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 // ======================================================================== 14 15 package org.mortbay.jetty.handler; 16 17 /** 18 * @version $Revision: 5236 $ $Date: 2009-06-17 07:36:08 +1000 (Wed, 17 Jun 2009) $ 19 */ 20 public abstract class AbstractStatisticsHandler extends HandlerWrapper 21 { 22 protected void doStart() throws Exception 23 { 24 super.doStart(); 25 statsReset(); 26 } 27 28 /** 29 * Resets the current request statistics. 30 */ 31 public abstract void statsReset(); 32 33 /** 34 * @return the number of requests handled by this handler 35 * since {@link #statsReset()} was last called. 36 */ 37 public abstract int getRequests(); 38 39 /** 40 * @return the number of requests currently active. 41 * since {@link #statsReset()} was last called. 42 */ 43 public abstract int getRequestsActive(); 44 45 /** 46 * @return the maximum number of active requests 47 * since {@link #statsReset()} was last called. 48 */ 49 public abstract int getRequestsActiveMax(); 50 51 /** 52 * @return the number of responses with a 1xx status returned by this context 53 * since {@link #statsReset()} was last called. 54 */ 55 public abstract int getResponses1xx(); 56 57 /** 58 * @return the number of responses with a 2xx status returned by this context 59 * since {@link #statsReset()} was last called. 60 */ 61 public abstract int getResponses2xx(); 62 63 /** 64 * @return the number of responses with a 3xx status returned by this context 65 * since {@link #statsReset()} was last called. 66 */ 67 public abstract int getResponses3xx(); 68 69 /** 70 * @return the number of responses with a 4xx status returned by this context 71 * since {@link #statsReset()} was last called. 72 */ 73 public abstract int getResponses4xx(); 74 75 /** 76 * @return the number of responses with a 5xx status returned by this context 77 * since {@link #statsReset()} was last called. 78 */ 79 public abstract int getResponses5xx(); 80 81 /** 82 * @return the milliseconds since the statistics were started with {@link #statsReset()}. 83 */ 84 public abstract long getStatsOnMs(); 85 86 /** 87 * @return the minimum time (in milliseconds) of request handling 88 * since {@link #statsReset()} was last called. 89 */ 90 public abstract long getRequestTimeMin(); 91 92 /** 93 * @return the maximum time (in milliseconds) of request handling 94 * since {@link #statsReset()} was last called. 95 */ 96 public abstract long getRequestTimeMax(); 97 98 /** 99 * @return the total time (in milliseconds) of requests handling 100 * since {@link #statsReset()} was last called. 101 */ 102 public abstract long getRequestTimeTotal(); 103 104 /** 105 * @return the average time (in milliseconds) of request handling 106 * since {@link #statsReset()} was last called. 107 * @see #getRequestTimeTotal() 108 * @see #getRequests() 109 */ 110 public abstract long getRequestTimeAverage(); 111 }