001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * 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 and
015 * limitations under the License.
016 */
017package org.apache.wicket.jmx;
018
019import java.io.IOException;
020
021import org.apache.wicket.protocol.http.WebApplication;
022
023
024/**
025 * Interface for exposing the request logger.
026 * 
027 * @author eelcohillenius
028 */
029public interface RequestLoggerMBean
030{
031        /**
032         * Total number of sessions ever created since the application was started.
033         * <p>
034         * Only available for {@link WebApplication web applications}.
035         * </p>
036         * 
037         * @return the total number of sessions ever created since the application was started
038         * @throws IOException
039         */
040        Integer getNumberOfCreatedSessions() throws IOException;
041
042        /**
043         * Gets the (recorded) number of currently live sessions.
044         * <p>
045         * Only available for {@link WebApplication web applications}.
046         * </p>
047         * 
048         * @return current (recorded) number of live sessions
049         * @throws IOException
050         */
051        Integer getNumberOfLiveSessions() throws IOException;
052
053        /**
054         * The largest number of concurrent sessions since the application was started.
055         * <p>
056         * Only available for {@link WebApplication web applications}.
057         * </p>
058         * 
059         * @return the largest number of concurrent sessions since the application was started
060         * @throws IOException
061         */
062        Integer getPeakNumberOfSessions() throws IOException;
063
064        /**
065         * Gets the current active requests number
066         * 
067         * @return current (at the time of method invocation) number of concurrent request being
068         *         processed
069         * @throws IOException
070         */
071        Integer getNumberOfCurrentActiveRequests() throws IOException;
072
073        /**
074         * The high water mark for the number of requests being processed concurrently
075         * 
076         * @return the largest number of the concurrent requests being processed
077         * @throws IOException
078         */
079        Integer getPeakNumberOfActiveRequests() throws IOException;
080
081        /**
082         * Registers a new request logger at the application. You need a request logger for some
083         * functions of the session bean. Be aware that sessions will be logged from this time on, so
084         * they may not reflect the actual number of sessions. Also, if one was registered, it will be
085         * replaced by a new one, which then starts over counting, disregarding the current ones.
086         * <p>
087         * Only available for {@link WebApplication web applications}.
088         * </p>
089         * 
090         * @throws IOException
091         */
092        void restart() throws IOException;
093
094        /**
095         * Removes any set request logger from the application. You need a request logger for some
096         * functions of the session bean.
097         * <p>
098         * Only available for {@link WebApplication web applications}.
099         * </p>
100         * 
101         * @throws IOException
102         */
103        void stop() throws IOException;
104}