1 /* 2 * Copyright 2005 Joe Walker 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 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.directwebremoting.extend; 17 18 /** 19 * Polling or Comet style interactive web applications require something to 20 * monitor high levels of server load to ensure that 21 * @author Joe Walker [joe at getahead dot ltd dot uk] 22 */ 23 public interface ServerLoadMonitor 24 { 25 /** 26 * Controller for poll times. 27 * <p>TODO: We should probably get rid of this and leave it to PollHandler? 28 * @return How long should this client wait until it next polls? 29 */ 30 int getDisconnectedTime(); 31 32 /** 33 * What's the longest time that we should wait before asking the client to 34 * reconnect? 35 * @return The maximum client connected time 36 */ 37 long getConnectedTime(); 38 39 /** 40 * A thread is about to begin a wait period. 41 * This can be used by implementations to dynamically adjust the poll 42 * timings. 43 * @param controller An object that we can use to control the wait 44 */ 45 void threadWaitStarting(WaitController controller); 46 47 /** 48 * A thread has just ended a wait period. 49 * This can be used by implementations to dynamically adjust the poll 50 * timings. 51 * @param controller An object that we can use to control the wait 52 */ 53 void threadWaitEnding(WaitController controller); 54 55 /** 56 * Kill all available long-poll requests 57 */ 58 void shutdown(); 59 } 60