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.impl;
17:
18: import org.apache.commons.logging.Log;
19: import org.apache.commons.logging.LogFactory;
20: import org.directwebremoting.extend.ServerLoadMonitor;
21:
22: /**
23: * A default implementation of ServerLoadMonitor
24: * @author Joe Walker [joe at getahead dot ltd dot uk]
25: */
26: public class PollingServerLoadMonitor extends AbstractServerLoadMonitor
27: implements ServerLoadMonitor {
28: /* (non-Javadoc)
29: * @see org.directwebremoting.extend.ServerLoadMonitor#supportsStreaming()
30: */
31: public boolean supportsStreaming() {
32: return false;
33: }
34:
35: /* (non-Javadoc)
36: * @see org.directwebremoting.extend.ServerLoadMonitor#getMaxConnectedTime()
37: */
38: public long getConnectedTime() {
39: return 0;
40: }
41:
42: /* (non-Javadoc)
43: * @see org.directwebremoting.ServerLoadMonitor#timeToNextPoll()
44: */
45: public int getDisconnectedTime() {
46: return disconnectedTime;
47: }
48:
49: /**
50: * Accessor for the disconnected time.
51: * @param disconnectedTime How long should clients spend disconnected
52: * @deprecated Use {@link #setDisconnectedTime(int)} instead
53: */
54: @Deprecated
55: public void setTimeToNextPoll(int disconnectedTime) {
56: log
57: .warn("timeToNextPoll is deprecated. Please use disconnectedTime");
58: this .disconnectedTime = disconnectedTime;
59: }
60:
61: /**
62: * Accessor for the disconnected time.
63: * @param disconnectedTime How long should clients spend disconnected
64: */
65: public void setDisconnectedTime(int disconnectedTime) {
66: this .disconnectedTime = disconnectedTime;
67: }
68:
69: /**
70: * How long are we telling users to wait before they come back next
71: */
72: protected int disconnectedTime = 5000;
73:
74: /**
75: * The log stream
76: */
77: private static final Log log = LogFactory
78: .getLog(PollingServerLoadMonitor.class);
79: }
|