001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.geronimo.tomcat.connector;
020:
021: import java.util.Map;
022:
023: import org.apache.geronimo.gbean.GBeanInfo;
024: import org.apache.geronimo.gbean.GBeanInfoBuilder;
025: import org.apache.geronimo.management.geronimo.WebManager;
026: import org.apache.geronimo.system.serverinfo.ServerInfo;
027: import org.apache.geronimo.tomcat.TomcatContainer;
028:
029: public class Http11NIOConnectorGBean extends
030: AbstractHttp11ConnectorGBean implements Http11NIOProtocol {
031:
032: public Http11NIOConnectorGBean(String name, Map initParams,
033: String host, int port, TomcatContainer container,
034: ServerInfo serverInfo) throws Exception {
035: super (name, initParams,
036: "org.apache.coyote.http11.Http11NioProtocol", host,
037: port, container, serverInfo);
038: }
039:
040: public int getDefaultPort() {
041: return 80;
042: }
043:
044: public String getGeronimoProtocol() {
045: return WebManager.PROTOCOL_HTTP;
046: }
047:
048: public int getAcceptorThreadCount() {
049: Object value = connector.getAttribute("acceptorThreadCount");
050: return value == null ? 1 : Integer.parseInt(value.toString());
051: }
052:
053: public int getAcceptorThreadPriority() {
054: Object value = connector.getAttribute("acceptorThreadCount");
055: return value == null ? Thread.NORM_PRIORITY : Integer
056: .parseInt(value.toString());
057: }
058:
059: public boolean getCommand_line_options() {
060: Object value = connector.getAttribute("command-line-options");
061: return value == null ? true : new Boolean(value.toString())
062: .booleanValue();
063: }
064:
065: public int getOomParachute() {
066: Object value = connector.getAttribute("oomParachute");
067: return value == null ? 1048576 : Integer.parseInt(value
068: .toString());
069: }
070:
071: public int getPollerThreadCount() {
072: Object value = connector.getAttribute("pollerThreadCount");
073: return value == null ? 1 : Integer.parseInt(value.toString());
074: }
075:
076: public int getPollerThreadPriority() {
077: Object value = connector.getAttribute("pollerThreadCount");
078: return value == null ? Thread.NORM_PRIORITY : Integer
079: .parseInt(value.toString());
080: }
081:
082: public int getProcessCache() {
083: Object value = connector.getAttribute("processCache");
084: return value == null ? 200 : Integer.parseInt(value.toString());
085: }
086:
087: public int getSelectorPool_maxSelectors() {
088: Object value = connector
089: .getAttribute("selectorPool.maxSelectors");
090: return value == null ? 200 : Integer.parseInt(value.toString());
091: }
092:
093: public int getSelectorPool_maxSpareSelectors() {
094: Object value = connector
095: .getAttribute("selectorPool.maxSpareSelectors");
096: return value == null ? -1 : Integer.parseInt(value.toString());
097: }
098:
099: public int getSelectorTimeout() {
100: Object value = connector.getAttribute("selectorTimeout");
101: return value == null ? 1000 : Integer
102: .parseInt(value.toString());
103: }
104:
105: public int getSocket_appReadBufSize() {
106: Object value = connector.getAttribute("socket.appReadBufSize");
107: return value == null ? 8192 : Integer
108: .parseInt(value.toString());
109: }
110:
111: public int getSocket_appWriteBufSize() {
112: Object value = connector.getAttribute("socket.appWriteBufSize");
113: return value == null ? 8192 : Integer
114: .parseInt(value.toString());
115: }
116:
117: public int getSocket_bufferPool() {
118: Object value = connector.getAttribute("socket.bufferPool");
119: return value == null ? 500 : Integer.parseInt(value.toString());
120: }
121:
122: public int getSocket_bufferPoolSize() {
123: Object value = connector.getAttribute("socket.bufferPoolSize");
124: return value == null ? 104857600 : Integer.parseInt(value
125: .toString());
126: }
127:
128: public boolean getSocket_directBuffer() {
129: Object value = connector.getAttribute("socket.directBuffer");
130: return value == null ? false : new Boolean(value.toString())
131: .booleanValue();
132: }
133:
134: public int getSocket_eventCache() {
135: Object value = connector.getAttribute("socket.eventCache");
136: return value == null ? 500 : Integer.parseInt(value.toString());
137: }
138:
139: public int getSocket_keyCache() {
140: Object value = connector.getAttribute("socket.keyCache");
141: return value == null ? 500 : Integer.parseInt(value.toString());
142: }
143:
144: public boolean getSocket_ooBInline() {
145: Object value = connector.getAttribute("socket.ooBInline");
146: return value == null ? true : new Boolean(value.toString())
147: .booleanValue();
148: }
149:
150: public int getSocket_performanceBandwidth() {
151: Object value = connector
152: .getAttribute("socket.performanceBandwidth");
153: return value == null ? 1 : Integer.parseInt(value.toString());
154: }
155:
156: public int getSocket_performanceConnectionTime() {
157: Object value = connector
158: .getAttribute("socket.performanceConnectionTime");
159: return value == null ? 1 : Integer.parseInt(value.toString());
160: }
161:
162: public int getSocket_performanceLatency() {
163: Object value = connector
164: .getAttribute("socket.performanceLatency");
165: return value == null ? 0 : Integer.parseInt(value.toString());
166: }
167:
168: public int getSocket_processorCache() {
169: Object value = connector.getAttribute("socket.processorCache");
170: return value == null ? 500 : Integer.parseInt(value.toString());
171: }
172:
173: public int getSocket_rxBufSize() {
174: Object value = connector.getAttribute("socket.rxBufSize");
175: return value == null ? 25188 : Integer.parseInt(value
176: .toString());
177: }
178:
179: public boolean getSocket_soKeepAlive() {
180: Object value = connector.getAttribute("socket.soKeepAlive");
181: return value == null ? false : new Boolean(value.toString())
182: .booleanValue();
183: }
184:
185: public boolean getSocket_soLingerOn() {
186: Object value = connector.getAttribute("socket.soLingerOn");
187: return value == null ? true : new Boolean(value.toString())
188: .booleanValue();
189: }
190:
191: public int getSocket_soLingerTime() {
192: Object value = connector.getAttribute("socket.soLingerTime");
193: return value == null ? 25 : Integer.parseInt(value.toString());
194: }
195:
196: public boolean getSocket_soReuseAddress() {
197: Object value = connector.getAttribute("socket.soReuseAddress");
198: return value == null ? true : new Boolean(value.toString())
199: .booleanValue();
200: }
201:
202: public int getSocket_soTimeout() {
203: Object value = connector.getAttribute("socket.soTimeout");
204: return value == null ? 5000 : Integer
205: .parseInt(value.toString());
206: }
207:
208: public int getSocket_soTrafficClass() {
209: Object value = connector.getAttribute("socket.soTrafficClass");
210: return value == null ? (0x04 | 0x08 | 0x010) : new Integer(
211: value.toString()).intValue();
212: }
213:
214: public boolean getSocket_tcpNoDelay() {
215: Object value = connector.getAttribute("socket.tcpNoDelay");
216: return value == null ? false : new Boolean(value.toString())
217: .booleanValue();
218: }
219:
220: public int getSocket_txBufSize() {
221: Object value = connector.getAttribute("socket.txBufSize");
222: return value == null ? 43800 : Integer.parseInt(value
223: .toString());
224: }
225:
226: public boolean getUseComet() {
227: Object value = connector.getAttribute("useComet");
228: return value == null ? true : new Boolean(value.toString())
229: .booleanValue();
230: }
231:
232: public boolean getUseExecutor() {
233: Object value = connector.getAttribute("useExecutor");
234: return value == null ? true : new Boolean(value.toString())
235: .booleanValue();
236: }
237:
238: public boolean getUseSendfile() {
239: Object value = connector.getAttribute("useSendfile");
240: return value == null ? true : new Boolean(value.toString())
241: .booleanValue();
242: }
243:
244: public void setAcceptorThreadCount(int acceptorThreadCount) {
245: connector.setAttribute("acceptorThreadCount", new Integer(
246: acceptorThreadCount));
247: }
248:
249: public void setAcceptorThreadPriority(int acceptorThreadPriority) {
250: connector.setAttribute("acceptorThreadPriority", new Integer(
251: acceptorThreadPriority));
252: }
253:
254: public void setCommand_line_options(boolean command_line_options) {
255: connector.setAttribute("command-line-options", new Boolean(
256: command_line_options));
257: }
258:
259: public void setOomParachute(int oomParachute) {
260: connector.setAttribute("oomParachute",
261: new Integer(oomParachute));
262: }
263:
264: public void setPollerThreadCount(int pollerThreadCount) {
265: connector.setAttribute("pollerThreadCount", new Integer(
266: pollerThreadCount));
267: }
268:
269: public void setPollerThreadPriority(int pollerThreadPriority) {
270: connector.setAttribute("pollerThreadPriority", new Integer(
271: pollerThreadPriority));
272: }
273:
274: public void setProcessCache(int processCache) {
275: connector.setAttribute("processCache",
276: new Integer(processCache));
277: }
278:
279: public void setSelectorPool_maxSelectors(
280: int selectorPool_maxSelectors) {
281: connector.setAttribute("selectorPool.maxSelectors",
282: new Integer(selectorPool_maxSelectors));
283: }
284:
285: public void setSelectorPool_maxSpareSelectors(
286: int selectorPool_maxSpareSelectors) {
287: connector.setAttribute("selectorPool.maxSpareSelectors",
288: new Integer(selectorPool_maxSpareSelectors));
289: }
290:
291: public void setSelectorTimeout(int selectorTimeout) {
292: connector.setAttribute("selectorTimeout", new Integer(
293: selectorTimeout));
294: }
295:
296: public void setSocket_appReadBufSize(int socket_appReadBufSize) {
297: connector.setAttribute("socket.appReadBufSize", new Integer(
298: socket_appReadBufSize));
299: }
300:
301: public void setSocket_appWriteBufSize(int socket_appWriteBufSize) {
302: connector.setAttribute("socket.appWriteBufSize", new Integer(
303: socket_appWriteBufSize));
304: }
305:
306: public void setSocket_bufferPool(int socket_bufferPool) {
307: connector.setAttribute("socket.bufferPool", new Integer(
308: socket_bufferPool));
309: }
310:
311: public void setSocket_bufferPoolSize(int socket_bufferPoolSize) {
312: connector.setAttribute("socket.bufferPoolSize", new Integer(
313: socket_bufferPoolSize));
314: }
315:
316: public void setSocket_directBuffer(boolean socket_directBuffer) {
317: connector.setAttribute("socket.directBuffer", new Boolean(
318: socket_directBuffer));
319: }
320:
321: public void setSocket_eventCache(int socket_eventCache) {
322: connector.setAttribute("socket.eventCache", new Integer(
323: socket_eventCache));
324: }
325:
326: public void setSocket_keyCache(int socket_keyCache) {
327: connector.setAttribute("socket.keyCache", new Integer(
328: socket_keyCache));
329: }
330:
331: public void setSocket_ooBInline(boolean socket_ooBInline) {
332: connector.setAttribute("socket.ooBInline", new Boolean(
333: socket_ooBInline));
334: }
335:
336: public void setSocket_performanceBandwidth(
337: int socket_performanceBandwidth) {
338: connector.setAttribute("socket.performanceBandwidth",
339: new Integer(socket_performanceBandwidth));
340: }
341:
342: public void setSocket_performanceConnectionTime(
343: int socket_performanceConnectionTime) {
344: connector.setAttribute("socket.performanceConnectionTime",
345: new Integer(socket_performanceConnectionTime));
346: }
347:
348: public void setSocket_performanceLatency(
349: int socket_performanceLatency) {
350: connector.setAttribute("socket.performanceLatency",
351: new Integer(socket_performanceLatency));
352: }
353:
354: public void setSocket_processorCache(int socket_processorCache) {
355: connector.setAttribute("socket.processorCache", new Integer(
356: socket_processorCache));
357: }
358:
359: public void setSocket_rxBufSize(int socket_rxBufSize) {
360: connector.setAttribute("socket.rxBufSize", new Integer(
361: socket_rxBufSize));
362: }
363:
364: public void setSocket_soKeepAlive(boolean socket_soKeepAlive) {
365: connector.setAttribute("socket.soKeepAlive", new Boolean(
366: socket_soKeepAlive));
367: }
368:
369: public void setSocket_soLingerOn(boolean socket_soLingerOn) {
370: connector.setAttribute("socket.soLingerOn", new Boolean(
371: socket_soLingerOn));
372: }
373:
374: public void setSocket_soLingerTime(int socket_soLingerTime) {
375: connector.setAttribute("socket.soLingerTime", new Integer(
376: socket_soLingerTime));
377: }
378:
379: public void setSocket_soReuseAddress(boolean socket_soReuseAddress) {
380: connector.setAttribute("socket.soReuseAddress", new Boolean(
381: socket_soReuseAddress));
382: }
383:
384: public void setSocket_soTimeout(int socket_soTimeout) {
385: connector.setAttribute("socket.soTimeout", new Integer(
386: socket_soTimeout));
387: }
388:
389: public void setSocket_soTrafficClass(int socket_soTrafficClass) {
390: connector.setAttribute("socket.soTrafficClass", new Integer(
391: socket_soTrafficClass));
392: }
393:
394: public void setSocket_tcpNoDelay(boolean socket_tcpNoDelay) {
395: connector.setAttribute("socket.tcpNoDelay", new Boolean(
396: socket_tcpNoDelay));
397: }
398:
399: public void setSocket_txBufSize(int socket_txBufSize) {
400: connector.setAttribute("socket.txBufSize", new Integer(
401: socket_txBufSize));
402: }
403:
404: public void setUseComet(boolean useComet) {
405: connector.setAttribute("useExecutor", new Boolean(useComet));
406: }
407:
408: public void setUseExecutor(boolean useExecutor) {
409: connector.setAttribute("useExecutor", new Boolean(useExecutor));
410: }
411:
412: public void setUseSendfile(boolean useSendfile) {
413: connector.setAttribute("useSendfile", new Boolean(useSendfile));
414: }
415:
416: public static final GBeanInfo GBEAN_INFO;
417:
418: static {
419: GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(
420: "Tomcat Connector HTTP NIO",
421: Http11NIOConnectorGBean.class,
422: AbstractHttp11ConnectorGBean.GBEAN_INFO);
423: infoFactory.addInterface(Http11NIOProtocol.class, new String[] {
424: "useSendfile", "useExecutor", "acceptorThreadCount",
425: "pollerThreadCount", "pollerThreadPriority",
426: "acceptorThreadPriority", "selectorTimeout",
427: "useComet", "processCache", "socket_directBuffer",
428: "socket_rxBufSize", "socket_txBufSize",
429: "socket_appReadBufSize", "socket_appWriteBufSize",
430: "socket_processorCache", "socket_bufferPool",
431: "socket_bufferPoolSize", "socket_keyCache",
432: "socket_eventCache", "socket_tcpNoDelay",
433: "socket_soKeepAlive", "socket_ooBInline",
434: "socket_soReuseAddress", "socket_soLingerOn",
435: "socket_soLingerTime", "socket_soTimeout",
436: "socket_soTrafficClass",
437: "socket_performanceConnectionTime",
438: "socket_performanceLatency",
439: "socket_performanceBandwidth",
440: "selectorPool_maxSelectors",
441: "selectorPool_maxSpareSelectors",
442: "command_line_options", "oomParachute" }, new String[] {
443: "useSendfile", "useExecutor", "acceptorThreadCount",
444: "pollerThreadCount", "pollerThreadPriority",
445: "acceptorThreadPriority", "selectorTimeout",
446: "useComet", "processCache", "socket_directBuffer",
447: "socket_rxBufSize", "socket_txBufSize",
448: "socket_appReadBufSize", "socket_appWriteBufSize",
449: "socket_processorCache", "socket_bufferPool",
450: "socket_bufferPoolSize", "socket_keyCache",
451: "socket_eventCache", "socket_tcpNoDelay",
452: "socket_soKeepAlive", "socket_ooBInline",
453: "socket_soReuseAddress", "socket_soLingerOn",
454: "socket_soLingerTime", "socket_soTimeout",
455: "socket_soTrafficClass",
456: "socket_performanceConnectionTime",
457: "socket_performanceLatency",
458: "socket_performanceBandwidth",
459: "selectorPool_maxSelectors",
460: "selectorPool_maxSpareSelectors",
461: "command_line_options", "oomParachute",
462:
463: });
464: infoFactory.setConstructor(new String[] { "name", "initParams",
465: "host", "port", "TomcatContainer", "ServerInfo" });
466: GBEAN_INFO = infoFactory.getBeanInfo();
467: }
468:
469: public static GBeanInfo getGBeanInfo() {
470: return GBEAN_INFO;
471: }
472:
473: }
|