01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: * If the server is not going to be streaming then we need to tell browsers
26: * to just use XHR rather than anything fancier.
27: * @return true if the server will be supporting streaming
28: */
29: boolean supportsStreaming();
30:
31: /**
32: * Controller for poll times.
33: * <p>TODO: We should probably get rid of this and leave it to PollHandler?
34: * @return How long should this client wait until it next polls?
35: */
36: int getDisconnectedTime();
37:
38: /**
39: * What's the longest time that we should wait before asking the client to
40: * reconnect?
41: * @return The maximum client connected time
42: */
43: long getConnectedTime();
44:
45: /**
46: * A thread is about to begin a wait period.
47: * This can be used by implementations to dynamically adjust the poll
48: * timings.
49: * @param controller An object that we can use to control the wait
50: */
51: void threadWaitStarting(WaitController controller);
52:
53: /**
54: * A thread has just ended a wait period.
55: * This can be used by implementations to dynamically adjust the poll
56: * timings.
57: * @param controller An object that we can use to control the wait
58: */
59: void threadWaitEnding(WaitController controller);
60:
61: /**
62: * Kill all available long-poll requests
63: */
64: void shutdown();
65: }
|