1 /**********************************************************************
2 * ServerInfo.java
3 * created on 11.07.2006 by netseeker
4 * $Id$
5 * $Log$
6 * Revision 1.12 2007/05/27 22:13:10 netseeker
7 * *** empty log message ***
8 *
9 * Revision 1.11 2007/05/22 22:50:46 netseeker
10 * added In-JVM processing mode, fixed a minor bug within the serverside detection of ADAPTER_STRATEGY_DIRECT.
11 *
12 * Revision 1.10 2006/11/12 20:34:43 netseeker
13 * *** empty log message ***
14 *
15 * Revision 1.9 2006/11/06 08:50:29 netseeker
16 * fixed java 1.4 support
17 *
18 * Revision 1.8 2006/11/05 16:31:58 netseeker
19 * finished the partial HTTP support for non-blocking IO
20 * code cleanup and reformatting
21 *
22 * Revision 1.7 2006/08/15 16:47:48 netseeker
23 * *** empty log message ***
24 *
25 * Revision 1.6 2006/08/09 20:13:54 netseeker
26 * *** empty log message ***
27 *
28 * Revision 1.5 2006/07/27 20:35:15 netseeker
29 * *** empty log message ***
30 *
31 *
32 * ====================================================================
33 *
34 * Copyright 2006 netseeker aka Michael Manske
35 *
36 * Licensed under the Apache License, Version 2.0 (the "License");
37 * you may not use this file except in compliance with the License.
38 * You may obtain a copy of the License at
39 *
40 * http://www.apache.org/licenses/LICENSE-2.0
41 *
42 * Unless required by applicable law or agreed to in writing, software
43 * distributed under the License is distributed on an "AS IS" BASIS,
44 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45 * See the License for the specific language governing permissions and
46 * limitations under the License.
47 * ====================================================================
48 *
49 * This file is part of the de.netseeker.ejoe framework.
50 * For more information on the author, please see
51 * <http://www.manskes.de/>.
52 *
53 *********************************************************************/
54
55 package de.netseeker.ejoe;
56
57 import java.nio.channels.SocketChannel;
58
59 import de.netseeker.ejoe.handler.ServerHandler;
60
61 /***
62 * @author netseeker
63 * @since 0.3.9.1
64 */
65 public class ServerInfo extends ConnectionHeader implements IServerInfo
66 {
67 private static final long serialVersionUID = 1L;
68
69 private ServerHandler _handler;
70
71 private int _port = EJConstants.EJOE_PORT;
72
73 private String _interface = "127.0.0.1";
74
75 private int _maxReadProcessors = EJConstants.EJOE_MAX_READPROCESSORS;
76
77 private int _maxWriteProcessors = EJConstants.EJOE_MAX_WRITEPROCESSORS;
78
79 private int _targetedConnectionProcessors = Runtime.getRuntime().availableProcessors();
80
81 private boolean _classServerEnabled;
82
83 private boolean _serverRunning;
84
85 private boolean _automaticThreadPoolResize;
86
87 private long _poolResizePeriod = EJConstants.EJOE_POOL_RESIZER_PERIOD;
88
89 /***
90 * @param isClient
91 */
92 public ServerInfo()
93 {
94 super( false );
95 }
96
97 /***
98 * @param channel
99 * @param host
100 * @param header
101 */
102 public ServerInfo(SocketChannel channel, String host, byte header)
103 {
104 super( channel, host, false, header );
105 }
106
107 /***
108 * @param channel
109 * @param host
110 */
111 public ServerInfo(SocketChannel channel, String host)
112 {
113 super( channel, host, false );
114 }
115
116 /***
117 * @param host
118 */
119 public ServerInfo(String host)
120 {
121 super( host, false );
122 }
123
124
125
126
127
128
129 public boolean isClassServerEnabled()
130 {
131 return _classServerEnabled;
132 }
133
134 /***
135 * @param serverEnabled The _classServerEnabled to set.
136 */
137 public void setClassServerEnabled( boolean serverEnabled )
138 {
139 _classServerEnabled = serverEnabled;
140 }
141
142
143
144
145
146
147 public ServerHandler getHandler()
148 {
149 return _handler;
150 }
151
152 /***
153 * @param _handler The _handler to set.
154 */
155 public void setHandler( ServerHandler _handler )
156 {
157 this._handler = _handler;
158 }
159
160
161
162
163
164
165 public String getInterface()
166 {
167 return _interface;
168 }
169
170 /***
171 * @param _interface The _interface to set.
172 */
173 public void setInterface( String _interface )
174 {
175 this._interface = _interface;
176 }
177
178
179
180
181
182
183 public int getMaxReadProcessors()
184 {
185 return _maxReadProcessors;
186 }
187
188 /***
189 * @param readProcessors The _maxReadProcessors to set.
190 */
191 public void setMaxReadProcessors( int readProcessors )
192 {
193 _maxReadProcessors = readProcessors;
194 }
195
196
197
198
199
200
201 public int getMaxWriteProcessors()
202 {
203 return _maxWriteProcessors;
204 }
205
206 /***
207 * @param writeProcessors The _maxWriteProcessors to set.
208 */
209 public void setMaxWriteProcessors( int writeProcessors )
210 {
211 _maxWriteProcessors = writeProcessors;
212 }
213
214
215
216
217
218
219 public int getPort()
220 {
221 return _port;
222 }
223
224 /***
225 * @param _port The _port to set.
226 */
227 public void setPort( int _port )
228 {
229 this._port = _port;
230 }
231
232
233
234
235
236
237 public boolean isServerRunning()
238 {
239 return _serverRunning;
240 }
241
242 /***
243 * @param running The _serverRunning to set.
244 */
245 public void setServerRunning( boolean running )
246 {
247 _serverRunning = running;
248 }
249
250
251
252
253
254
255 public boolean isAutomaticThreadPoolResize()
256 {
257 return _automaticThreadPoolResize;
258 }
259
260 /***
261 * @param threadPoolResize the _automaticThreadPoolResize to set
262 */
263 public void setAutomaticThreadPoolResize( boolean threadPoolResize )
264 {
265 _automaticThreadPoolResize = threadPoolResize;
266 }
267
268
269
270
271
272
273 public long getPoolResizePeriod()
274 {
275 return _poolResizePeriod;
276 }
277
278 /***
279 * @param resizePeriod the _poolResizePeriod to set
280 */
281 public void setPoolResizePeriod( long resizePeriod )
282 {
283 _poolResizePeriod = resizePeriod;
284 }
285
286
287
288
289
290
291 public int getTargetedConnectionProcessors()
292 {
293 return _targetedConnectionProcessors;
294 }
295
296 /***
297 * @param connectionProcessors the _targetedConnectionProcessors to set
298 */
299 public void setTargetedConnectionProcessors( int connectionProcessors )
300 {
301 _targetedConnectionProcessors = connectionProcessors;
302 }
303 }