1 | | /* | | 1 | | /* |
2 | | * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.12 2001/09/11 17:33: 02 craigmcc Exp $ | | 2 | | * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.17 2002/03/18 07:15:40 remm Exp $ |
3 | | * $Revision: 1.12 $ | | 3 | | * $Revision: 1.17 $ |
4 | | * $Date: 2001/09/11 17:33: 02 $ | | 4 | | * $Date: 2002/03/18 07:15:40 $ |
5 | | * | | 5 | | * |
6 | | * ==================================================================== | | 6 | | * ==================================================================== |
7 | | * | | 7 | | * |
8 | | * The Apache Software License, Version 1.1 | | 8 | | * The Apache Software License, Version 1.1 |
9 | | * | | 9 | | * |
10 | | * Copyright (c) 1999 The Apache Software Foundation. All rights | | 10 | | * Copyright (c) 1999 The Apache Software Foundation. All rights |
11 | | * reserved. | | 11 | | * reserved. |
12 | | * | | 12 | | * |
13 | | * Redistribution and use in source and binary forms, with or without | | 13 | | * Redistribution and use in source and binary forms, with or without |
14 | | * modification, are permitted provided that the following conditions | | 14 | | * modification, are permitted provided that the following conditions |
15 | | * are met: | | 15 | | * are met: |
16 | | * | | 16 | | * |
17 | | * 1. Redistributions of source code must retain the above copyright | | 17 | | * 1. Redistributions of source code must retain the above copyright |
18 | | * notice, this list of conditions and the following disclaimer. | | 18 | | * notice, this list of conditions and the following disclaimer. |
19 | | * | | 19 | | * |
20 | | * 2. Redistributions in binary form must reproduce the above copyright | | 20 | | * 2. Redistributions in binary form must reproduce the above copyright |
21 | | * notice, this list of conditions and the following disclaimer in | | 21 | | * notice, this list of conditions and the following disclaimer in |
22 | | * the documentation and/or other materials provided with the | | 22 | | * the documentation and/or other materials provided with the |
23 | | * distribution. | | 23 | | * distribution. |
24 | | * | | 24 | | * |
25 | | * 3. The end-user documentation included with the redistribution, if | | 25 | | * 3. The end-user documentation included with the redistribution, if |
26 | | * any, must include the following acknowlegement: | | 26 | | * any, must include the following acknowlegement: |
27 | | * "This product includes software developed by the | | 27 | | * "This product includes software developed by the |
28 | | * Apache Software Foundation (http://www.apache.org/)." | | 28 | | * Apache Software Foundation (http://www.apache.org/)." |
29 | | * Alternately, this acknowlegement may appear in the software itself, | | 29 | | * Alternately, this acknowlegement may appear in the software itself, |
30 | | * if and wherever such third-party acknowlegements normally appear. | | 30 | | * if and wherever such third-party acknowlegements normally appear. |
31 | | * | | 31 | | * |
32 | | * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | | 32 | | * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software |
33 | | * Foundation" must not be used to endorse or promote products derived | | 33 | | * Foundation" must not be used to endorse or promote products derived |
34 | | * from this software without prior written permission. For written | | 34 | | * from this software without prior written permission. For written |
35 | | * permission, please contact apache@apache.org. | | 35 | | * permission, please contact apache@apache.org. |
36 | | * | | 36 | | * |
37 | | * 5. Products derived from this software may not be called "Apache" | | 37 | | * 5. Products derived from this software may not be called "Apache" |
38 | | * nor may "Apache" appear in their names without prior written | | 38 | | * nor may "Apache" appear in their names without prior written |
39 | | * permission of the Apache Group. | | 39 | | * permission of the Apache Group. |
40 | | * | | 40 | | * |
41 | | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | | 41 | | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
42 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 42 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
43 | | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 43 | | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
44 | | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | | 44 | | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR |
45 | | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 45 | | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
46 | | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | | 46 | | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
47 | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | | 47 | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
48 | | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | | 48 | | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
49 | | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 49 | | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
50 | | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | | 50 | | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
51 | | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 51 | | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
52 | | * SUCH DAMAGE. | | 52 | | * SUCH DAMAGE. |
53 | | * ==================================================================== | | 53 | | * ==================================================================== |
54 | | * | | 54 | | * |
55 | | * This software consists of voluntary contributions made by many | | 55 | | * This software consists of voluntary contributions made by many |
56 | | * individuals on behalf of the Apache Software Foundation. For more | | 56 | | * individuals on behalf of the Apache Software Foundation. For more |
57 | | * information on the Apache Software Foundation, please see | | 57 | | * information on the Apache Software Foundation, please see |
58 | | * <http://www.apache.org/>. | | 58 | | * <http://www.apache.org/>. |
59 | | * | | 59 | | * |
60 | | * [Additional notices, if required by prior licensing conditions] | | 60 | | * [Additional notices, if required by prior licensing conditions] |
61 | | * | | 61 | | * |
62 | | */ | | 62 | | */ |
63 | | | | 63 | | |
64 | | | | 64 | | |
65 | | package org.apache.catalina.connector.http10; | | 65 | | package org.apache.catalina.connector.http10; |
66 | | | | 66 | | |
67 | | | | 67 | | |
68 | | import java.io.IOException; | | 68 | | import java.io.IOException; |
69 | | import java.net.InetAddress; | | 69 | | import java.net.InetAddress; |
70 | | import java.net.ServerSocket; | | 70 | | import java.net.ServerSocket; |
71 | | import java.net.Socket; | | 71 | | import java.net.Socket; |
72 | | import java.security.AccessControlException; | | 72 | | import java.security.AccessControlException; |
73 | | import java.util.Stack; | | 73 | | import java.util.Stack; |
74 | | import java.util.Vector; | | 74 | | import java.util.Vector; |
| | | | 75 | | import java.security.KeyStoreException; |
| | | | 76 | | import java.security.NoSuchAlgorithmException; |
| | | | 77 | | import java.security.cert.CertificateException; |
| | | | 78 | | import java.security.UnrecoverableKeyException; |
| | | | 79 | | import java.security.KeyManagementException; |
75 | | import org.apache.catalina.Connector; | | 80 | | import org.apache.catalina.Connector; |
76 | | import org.apache.catalina.Container; | | 81 | | import org.apache.catalina.Container; |
77 | | import org.apache.catalina.HttpRequest; | | 82 | | import org.apache.catalina.HttpRequest; |
78 | | import org.apache.catalina.HttpResponse; | | 83 | | import org.apache.catalina.HttpResponse; |
79 | | import org.apache.catalina.Lifecycle; | | 84 | | import org.apache.catalina.Lifecycle; |
80 | | import org.apache.catalina.LifecycleEvent; | | 85 | | import org.apache.catalina.LifecycleEvent; |
81 | | import org.apache.catalina.LifecycleException; | | 86 | | import org.apache.catalina.LifecycleException; |
82 | | import org.apache.catalina.LifecycleListener; | | 87 | | import org.apache.catalina.LifecycleListener; |
83 | | import org.apache.catalina.Logger; | | 88 | | import org.apache.catalina.Logger; |
84 | | import org.apache.catalina.Request; | | 89 | | import org.apache.catalina.Request; |
85 | | import org.apache.catalina.Response; | | 90 | | import org.apache.catalina.Response; |
86 | | import org.apache.catalina.Service; | | 91 | | import org.apache.catalina.Service; |
87 | | import org.apache.catalina.net.DefaultServerSocketFactory; | | 92 | | import org.apache.catalina.net.DefaultServerSocketFactory; |
88 | | import org.apache.catalina.net.ServerSocketFactory; | | 93 | | import org.apache.catalina.net.ServerSocketFactory; |
89 | | import org.apache.catalina.util.LifecycleSupport; | | 94 | | import org.apache.catalina.util.LifecycleSupport; |
90 | | import org.apache.catalina.util.StringManager; | | 95 | | import org.apache.catalina.util.StringManager; |
91 | | | | 96 | | |
92 | | | | 97 | | |
93 | | /** | | 98 | | /** |
94 | | * Simple implementation of an HTTP/1.0 Connector, for testing and debugging | | 99 | | * Simple implementation of an HTTP/1.0 Connector, for testing and debugging |
95 | | * purposes. Not intended to be the final solution. | | 100 | | * purposes. Not intended to be the final solution. |
96 | | * | | 101 | | * |
97 | | * @author Craig R. McClanahan | | 102 | | * @author Craig R. McClanahan |
98 | | * @version $Revision: 1.12 $ $Date: 2001/09/11 17:33: 02 $ | | 103 | | * @version $Revision: 1.17 $ $Date: 2002/03/18 07:15:40 $ |
| | | | 104 | | * @deprecated |
99 | | */ | | 105 | | */ |
100 | | | | 106 | | |
101 | | | | 107 | | |
102 | | public final class HttpConnector | | 108 | | public final class HttpConnector |
103 | | implements Connector, Lifecycle, Runnable { | | 109 | | implements Connector, Lifecycle, Runnable { |
104 | | | | 110 | | |
105 | | | | 111 | | |
106 | | // ----------------------------------------------------- Instance Variables | | 112 | | // ----------------------------------------------------- Instance Variables |
107 | | | | 113 | | |
108 | | | | 114 | | |
109 | | /** | | 115 | | /** |
110 | | * The accept count for this Connector. | | 116 | | * The accept count for this Connector. |
111 | | */ | | 117 | | */ |
112 | | private int acceptCount = 10; | | 118 | | private int acceptCount = 10; |
113 | | | | 119 | | |
114 | | | | 120 | | |
115 | | /** | | 121 | | /** |
116 | | * The IP address on which to bind, if any. If <code>null</code>, all | | 122 | | * The IP address on which to bind, if any. If <code>null</code>, all |
117 | | * addresses on the server will be bound. | | 123 | | * addresses on the server will be bound. |
118 | | */ | | 124 | | */ |
119 | | private String address = null; | | 125 | | private String address = null; |
120 | | | | 126 | | |
121 | | | | 127 | | |
122 | | /** | | 128 | | /** |
123 | | * The input buffer size we should create on input streams. | | 129 | | * The input buffer size we should create on input streams. |
124 | | */ | | 130 | | */ |
125 | | private int bufferSize = 2048; | | 131 | | private int bufferSize = 2048; |
126 | | | | 132 | | |
127 | | | | 133 | | |
128 | | /** | | 134 | | /** |
129 | | * The Container used for processing requests received by this Connector. | | 135 | | * The Container used for processing requests received by this Connector. |
130 | | */ | | 136 | | */ |
131 | | protected Container container = null; | | 137 | | protected Container container = null; |
132 | | | | 138 | | |
133 | | | | 139 | | |
134 | | /** | | 140 | | /** |
135 | | * The set of processors that have ever been created. | | 141 | | * The set of processors that have ever been created. |
136 | | */ | | 142 | | */ |
137 | | private Vector created = new Vector(); | | 143 | | private Vector created = new Vector(); |
138 | | | | 144 | | |
139 | | | | 145 | | |
140 | | /** | | 146 | | /** |
141 | | * The current number of processors that have been created. | | 147 | | * The current number of processors that have been created. |
142 | | */ | | 148 | | */ |
143 | | private int curProcessors = 0; | | 149 | | private int curProcessors = 0; |
144 | | | | 150 | | |
145 | | | | 151 | | |
146 | | /** | | 152 | | /** |
147 | | * The debugging detail level for this component. | | 153 | | * The debugging detail level for this component. |
148 | | */ | | 154 | | */ |
149 | | private int debug = 0; | | 155 | | private int debug = 0; |
150 | | | | 156 | | |
151 | | | | 157 | | |
152 | | /** | | 158 | | /** |
153 | | * The "enable DNS lookups" flag for this Connector. | | 159 | | * The "enable DNS lookups" flag for this Connector. |
154 | | */ | | 160 | | */ |
155 | | private boolean enableLookups = false; | | 161 | | private boolean enableLookups = false; |
156 | | | | 162 | | |
157 | | | | 163 | | |
158 | | /** | | 164 | | /** |
159 | | * The server socket factory for this component. | | 165 | | * The server socket factory for this component. |
160 | | */ | | 166 | | */ |
161 | | private ServerSocketFactory factory = null; | | 167 | | private ServerSocketFactory factory = null; |
162 | | | | 168 | | |
163 | | | | 169 | | |
164 | | /** | | 170 | | /** |
165 | | * Descriptive information about this Connector implementation. | | 171 | | * Descriptive information about this Connector implementation. |
166 | | */ | | 172 | | */ |
167 | | private static final String info = | | 173 | | private static final String info = |
168 | | "org.apache.catalina.connector.http10.HttpConnector/1.0"; | | 174 | | "org.apache.catalina.connector.http10.HttpConnector/1.0"; |
169 | | | | 175 | | |
170 | | | | 176 | | |
171 | | /** | | 177 | | /** |
172 | | * The lifecycle event support for this component. | | 178 | | * The lifecycle event support for this component. |
173 | | */ | | 179 | | */ |
174 | | protected LifecycleSupport lifecycle = new LifecycleSupport(this); | | 180 | | protected LifecycleSupport lifecycle = new LifecycleSupport(this); |
175 | | | | 181 | | |
176 | | | | 182 | | |
177 | | /** | | 183 | | /** |
178 | | * Timeout value on the incoming connection. | | 184 | | * Timeout value on the incoming connection. |
179 | | * Note : a negative value of 0 means no timeout. | | 185 | | * Note : a negative value of 0 means no timeout. |
180 | | */ | | 186 | | */ |
181 | | private int connectionTimeout = Constants.DEFAULT_CONNECTION_TIMEOUT; | | 187 | | private int connectionTimeout = Constants.DEFAULT_CONNECTION_TIMEOUT; |
182 | | | | 188 | | |
183 | | | | 189 | | |
184 | | /** | | 190 | | /** |
185 | | * The minimum number of processors to start at initialization time. | | 191 | | * The minimum number of processors to start at initialization time. |
186 | | */ | | 192 | | */ |
187 | | protected int minProcessors = 5; | | 193 | | protected int minProcessors = 5; |
188 | | | | 194 | | |
189 | | | | 195 | | |
190 | | /** | | 196 | | /** |
191 | | * The maximum number of processors allowed, or <0 for unlimited. | | 197 | | * The maximum number of processors allowed, or <0 for unlimited. |
192 | | */ | | 198 | | */ |
193 | | private int maxProcessors = 20; | | 199 | | private int maxProcessors = 20; |
194 | | | | 200 | | |
195 | | | | 201 | | |
196 | | /** | | 202 | | /** |
197 | | * The port number on which we listen for HTTP requests. | | 203 | | * The port number on which we listen for HTTP requests. |
198 | | */ | | 204 | | */ |
199 | | private int port = 8080; | | 205 | | private int port = 8080; |
200 | | | | 206 | | |
201 | | | | 207 | | |
202 | | /** | | 208 | | /** |
203 | | * The set of processors that have been created but are not currently | | 209 | | * The set of processors that have been created but are not currently |
204 | | * being used to process a request. | | 210 | | * being used to process a request. |
205 | | */ | | 211 | | */ |
206 | | private Stack processors = new Stack(); | | 212 | | private Stack processors = new Stack(); |
207 | | | | 213 | | |
208 | | | | 214 | | |
209 | | /** | | 215 | | /** |
210 | | * The server name to which we should pretend requests to this Connector | | 216 | | * The server name to which we should pretend requests to this Connector |
211 | | * were directed. This is useful when operating Tomcat behind a proxy | | 217 | | * were directed. This is useful when operating Tomcat behind a proxy |
212 | | * server, so that redirects get constructed accurately. If not specified, | | 218 | | * server, so that redirects get constructed accurately. If not specified, |
213 | | * the server name included in the <code>Host</code> header is used. | | 219 | | * the server name included in the <code>Host</code> header is used. |
214 | | */ | | 220 | | */ |
215 | | private String proxyName = null; | | 221 | | private String proxyName = null; |
216 | | | | 222 | | |
217 | | | | 223 | | |
218 | | /** | | 224 | | /** |
219 | | * The server port to which we should pretent requests to this Connector | | 225 | | * The server port to which we should pretent requests to this Connector |
220 | | * were directed. This is useful when operating Tomcat behind a proxy | | 226 | | * were directed. This is useful when operating Tomcat behind a proxy |
221 | | * server, so that redirects get constructed accurately. If not specified, | | 227 | | * server, so that redirects get constructed accurately. If not specified, |
222 | | * the port number specified by the <code>port</code> property is used. | | 228 | | * the port number specified by the <code>port</code> property is used. |
223 | | */ | | 229 | | */ |
224 | | private int proxyPort = 0; | | 230 | | private int proxyPort = 0; |
225 | | | | 231 | | |
226 | | | | 232 | | |
227 | | /** | | 233 | | /** |
228 | | * The redirect port for non-SSL to SSL redirects. | | 234 | | * The redirect port for non-SSL to SSL redirects. |
229 | | */ | | 235 | | */ |
230 | | private int redirectPort = 443; | | 236 | | private int redirectPort = 443; |
231 | | | | 237 | | |
232 | | | | 238 | | |
233 | | /** | | 239 | | /** |
234 | | * The request scheme that will be set on all requests received | | 240 | | * The request scheme that will be set on all requests received |
235 | | * through this connector. | | 241 | | * through this connector. |
236 | | */ | | 242 | | */ |
237 | | private String scheme = "http"; | | 243 | | private String scheme = "http"; |
238 | | | | 244 | | |
239 | | | | 245 | | |
240 | | /** | | 246 | | /** |
241 | | * The secure connection flag that will be set on all requests received | | 247 | | * The secure connection flag that will be set on all requests received |
242 | | * through this connector. | | 248 | | * through this connector. |
243 | | */ | | 249 | | */ |
244 | | private boolean secure = false; | | 250 | | private boolean secure = false; |
245 | | | | 251 | | |
246 | | | | 252 | | |
247 | | /** | | 253 | | /** |
248 | | * The server socket through which we listen for incoming TCP connections. | | 254 | | * The server socket through which we listen for incoming TCP connections. |
249 | | */ | | 255 | | */ |
250 | | private ServerSocket serverSocket = null; | | 256 | | private ServerSocket serverSocket = null; |
251 | | | | 257 | | |
252 | | | | 258 | | |
253 | | /** | | 259 | | /** |
254 | | * The <code>Service</code> we are associated with (if any). | | 260 | | * The <code>Service</code> we are associated with (if any). |
255 | | */ | | 261 | | */ |
256 | | private Service service = null; | | 262 | | private Service service = null; |
257 | | | | 263 | | |
258 | | | | 264 | | |
259 | | /** | | 265 | | /** |
260 | | * The string manager for this package. | | 266 | | * The string manager for this package. |
261 | | */ | | 267 | | */ |
262 | | private StringManager sm = | | 268 | | private StringManager sm = |
263 | | StringManager.getManager(Constants.Package); | | 269 | | StringManager.getManager(Constants.Package); |
264 | | | | 270 | | |
265 | | | | 271 | | |
266 | | /** | | 272 | | /** |
267 | | * Has this component been initialized yet? | | 273 | | * Has this component been initialized yet? |
268 | | */ | | 274 | | */ |
269 | | private boolean initialized = false; | | 275 | | private boolean initialized = false; |
270 | | | | 276 | | |
271 | | | | 277 | | |
272 | | /** | | 278 | | /** |
273 | | * Has this component been started yet? | | 279 | | * Has this component been started yet? |
274 | | */ | | 280 | | */ |
275 | | private boolean started = false; | | 281 | | private boolean started = false; |
276 | | | | 282 | | |
277 | | | | 283 | | |
278 | | /** | | 284 | | /** |
279 | | * The shutdown signal to our background thread | | 285 | | * The shutdown signal to our background thread |
280 | | */ | | 286 | | */ |
281 | | private boolean stopped = false; | | 287 | | private boolean stopped = false; |
282 | | | | 288 | | |
283 | | | | 289 | | |
284 | | /** | | 290 | | /** |
285 | | * The background thread. | | 291 | | * The background thread. |
286 | | */ | | 292 | | */ |
287 | | private Thread thread = null; | | 293 | | private Thread thread = null; |
288 | | | | 294 | | |
289 | | | | 295 | | |
290 | | /** | | 296 | | /** |
291 | | * The name to register for the background thread. | | 297 | | * The name to register for the background thread. |
292 | | */ | | 298 | | */ |
293 | | private String threadName = null; | | 299 | | private String threadName = null; |
294 | | | | 300 | | |
295 | | | | 301 | | |
296 | | /** | | 302 | | /** |
297 | | * The thread synchronization object. | | 303 | | * The thread synchronization object. |
298 | | */ | | 304 | | */ |
299 | | private Object threadSync = new Object(); | | 305 | | private Object threadSync = new Object(); |
300 | | | | 306 | | |
301 | | | | 307 | | |
302 | | // ------------------------------------------------------------- Properties | | 308 | | // ------------------------------------------------------------- Properties |
303 | | | | 309 | | |
304 | | | | 310 | | |
305 | | /** | | 311 | | /** |
306 | | * Return the connection timeout for this Connector. | | 312 | | * Return the connection timeout for this Connector. |
307 | | */ | | 313 | | */ |
308 | | public int getConnectionTimeout() { | | 314 | | public int getConnectionTimeout() { |
309 | | | | 315 | | |
310 | | return (connectionTimeout); | | 316 | | return (connectionTimeout); |
311 | | | | 317 | | |
312 | | } | | 318 | | } |
313 | | | | 319 | | |
314 | | | | 320 | | |
315 | | /** | | 321 | | /** |
316 | | * Set the connection timeout for this Connector. | | 322 | | * Set the connection timeout for this Connector. |
317 | | * | | 323 | | * |
318 | | * @param count The new connection timeout | | 324 | | * @param count The new connection timeout |
319 | | */ | | 325 | | */ |
320 | | public void setConnectionTimeout(int connectionTimeout) { | | 326 | | public void setConnectionTimeout(int connectionTimeout) { |
321 | | | | 327 | | |
322 | | this.connectionTimeout = connectionTimeout; | | 328 | | this.connectionTimeout = connectionTimeout; |
323 | | | | 329 | | |
324 | | } | | 330 | | } |
325 | | | | 331 | | |
326 | | | | 332 | | |
327 | | /** | | 333 | | /** |
328 | | * Return the accept count for this Connector. | | 334 | | * Return the accept count for this Connector. |
329 | | */ | | 335 | | */ |
330 | | public int getAcceptCount() { | | 336 | | public int getAcceptCount() { |
331 | | | | 337 | | |
332 | | return (acceptCount); | | 338 | | return (acceptCount); |
333 | | | | 339 | | |
334 | | } | | 340 | | } |
335 | | | | 341 | | |
336 | | | | 342 | | |
337 | | /** | | 343 | | /** |
338 | | * Set the accept count for this Connector. | | 344 | | * Set the accept count for this Connector. |
339 | | * | | 345 | | * |
340 | | * @param count The new accept count | | 346 | | * @param count The new accept count |
341 | | */ | | 347 | | */ |
342 | | public void setAcceptCount(int count) { | | 348 | | public void setAcceptCount(int count) { |
343 | | | | 349 | | |
344 | | this.acceptCount = count; | | 350 | | this.acceptCount = count; |
345 | | | | 351 | | |
346 | | } | | 352 | | } |
347 | | | | 353 | | |
348 | | | | 354 | | |
349 | | /** | | 355 | | /** |
350 | | * Return the bind IP address for this Connector. | | 356 | | * Return the bind IP address for this Connector. |
351 | | */ | | 357 | | */ |
352 | | public String getAddress() { | | 358 | | public String getAddress() { |
353 | | | | 359 | | |
354 | | return (this.address); | | 360 | | return (this.address); |
355 | | | | 361 | | |
356 | | } | | 362 | | } |
357 | | | | 363 | | |
358 | | | | 364 | | |
359 | | /** | | 365 | | /** |
360 | | * Set the bind IP address for this Connector. | | 366 | | * Set the bind IP address for this Connector. |
361 | | * | | 367 | | * |
362 | | * @param address The bind IP address | | 368 | | * @param address The bind IP address |
363 | | */ | | 369 | | */ |
364 | | public void setAddress(String address) { | | 370 | | public void setAddress(String address) { |
365 | | | | 371 | | |
366 | | this.address = address; | | 372 | | this.address = address; |
367 | | | | 373 | | |
368 | | } | | 374 | | } |
369 | | | | 375 | | |
370 | | | | 376 | | |
371 | | /** | | 377 | | /** |
372 | | * Is this connector available for processing requests? | | 378 | | * Is this connector available for processing requests? |
373 | | */ | | 379 | | */ |
374 | | public boolean isAvailable() { | | 380 | | public boolean isAvailable() { |
375 | | | | 381 | | |
376 | | return (started); | | 382 | | return (started); |
377 | | | | 383 | | |
378 | | } | | 384 | | } |
379 | | | | 385 | | |
380 | | | | 386 | | |
381 | | /** | | 387 | | /** |
382 | | * Return the input buffer size for this Connector. | | 388 | | * Return the input buffer size for this Connector. |
383 | | */ | | 389 | | */ |
384 | | public int getBufferSize() { | | 390 | | public int getBufferSize() { |
385 | | | | 391 | | |
386 | | return (this.bufferSize); | | 392 | | return (this.bufferSize); |
387 | | | | 393 | | |
388 | | } | | 394 | | } |
389 | | | | 395 | | |
390 | | | | 396 | | |
391 | | /** | | 397 | | /** |
392 | | * Set the input buffer size for this Connector. | | 398 | | * Set the input buffer size for this Connector. |
393 | | * | | 399 | | * |
394 | | * @param bufferSize The new input buffer size. | | 400 | | * @param bufferSize The new input buffer size. |
395 | | */ | | 401 | | */ |
396 | | public void setBufferSize(int bufferSize) { | | 402 | | public void setBufferSize(int bufferSize) { |
397 | | | | 403 | | |
398 | | this.bufferSize = bufferSize; | | 404 | | this.bufferSize = bufferSize; |
399 | | | | 405 | | |
400 | | } | | 406 | | } |
401 | | | | 407 | | |
402 | | | | 408 | | |
403 | | /** | | 409 | | /** |
404 | | * Return the Container used for processing requests received by this | | 410 | | * Return the Container used for processing requests received by this |
405 | | * Connector. | | 411 | | * Connector. |
406 | | */ | | 412 | | */ |
407 | | public Container getContainer() { | | 413 | | public Container getContainer() { |
408 | | | | 414 | | |
409 | | return (container); | | 415 | | return (container); |
410 | | | | 416 | | |
411 | | } | | 417 | | } |
412 | | | | 418 | | |
413 | | | | 419 | | |
414 | | /** | | 420 | | /** |
415 | | * Set the Container used for processing requests received by this | | 421 | | * Set the Container used for processing requests received by this |
416 | | * Connector. | | 422 | | * Connector. |
417 | | * | | 423 | | * |
418 | | * @param container The new Container to use | | 424 | | * @param container The new Container to use |
419 | | */ | | 425 | | */ |
420 | | public void setContainer(Container container) { | | 426 | | public void setContainer(Container container) { |
421 | | | | 427 | | |
422 | | this.container = container; | | 428 | | this.container = container; |
423 | | | | 429 | | |
424 | | } | | 430 | | } |
425 | | | | 431 | | |
426 | | | | 432 | | |
427 | | /** | | 433 | | /** |
428 | | * Return the current number of processors that have been created. | | 434 | | * Return the current number of processors that have been created. |
429 | | */ | | 435 | | */ |
430 | | public int getCurProcessors() { | | 436 | | public int getCurProcessors() { |
431 | | | | 437 | | |
432 | | return (curProcessors); | | 438 | | return (curProcessors); |
433 | | | | 439 | | |
434 | | } | | 440 | | } |
435 | | | | 441 | | |
436 | | | | 442 | | |
437 | | /** | | 443 | | /** |
438 | | * Return the debugging detail level for this component. | | 444 | | * Return the debugging detail level for this component. |
439 | | */ | | 445 | | */ |
440 | | public int getDebug() { | | 446 | | public int getDebug() { |
441 | | | | 447 | | |
442 | | return (debug); | | 448 | | return (debug); |
443 | | | | 449 | | |
444 | | } | | 450 | | } |
445 | | | | 451 | | |
446 | | | | 452 | | |
447 | | /** | | 453 | | /** |
448 | | * Set the debugging detail level for this component. | | 454 | | * Set the debugging detail level for this component. |
449 | | * | | 455 | | * |
450 | | * @param debug The new debugging detail level | | 456 | | * @param debug The new debugging detail level |
451 | | */ | | 457 | | */ |
452 | | public void setDebug(int debug) { | | 458 | | public void setDebug(int debug) { |
453 | | | | 459 | | |
454 | | this.debug = debug; | | 460 | | this.debug = debug; |
455 | | | | 461 | | |
456 | | } | | 462 | | } |
457 | | | | 463 | | |
458 | | | | 464 | | |
459 | | /** | | 465 | | /** |
460 | | * Return the "enable DNS lookups" flag. | | 466 | | * Return the "enable DNS lookups" flag. |
461 | | */ | | 467 | | */ |
462 | | public boolean getEnableLookups() { | | 468 | | public boolean getEnableLookups() { |
463 | | | | 469 | | |
464 | | return (this.enableLookups); | | 470 | | return (this.enableLookups); |
465 | | | | 471 | | |
466 | | } | | 472 | | } |
467 | | | | 473 | | |
468 | | | | 474 | | |
469 | | /** | | 475 | | /** |
470 | | * Set the "enable DNS lookups" flag. | | 476 | | * Set the "enable DNS lookups" flag. |
471 | | * | | 477 | | * |
472 | | * @param enableLookups The new "enable DNS lookups" flag value | | 478 | | * @param enableLookups The new "enable DNS lookups" flag value |
473 | | */ | | 479 | | */ |
474 | | public void setEnableLookups(boolean enableLookups) { | | 480 | | public void setEnableLookups(boolean enableLookups) { |
475 | | | | 481 | | |
476 | | this.enableLookups = enableLookups; | | 482 | | this.enableLookups = enableLookups; |
477 | | | | 483 | | |
478 | | } | | 484 | | } |
479 | | | | 485 | | |
480 | | | | 486 | | |
481 | | /** | | 487 | | /** |
482 | | * Return the server socket factory used by this Container. | | 488 | | * Return the server socket factory used by this Container. |
483 | | */ | | 489 | | */ |
484 | | public ServerSocketFactory getFactory() { | | 490 | | public ServerSocketFactory getFactory() { |
485 | | | | 491 | | |
486 | | if (this.factory == null) { | | 492 | | if (this.factory == null) { |
487 | | synchronized (this) { | | 493 | | synchronized (this) { |
488 | | this.factory = new DefaultServerSocketFactory(); | | 494 | | this.factory = new DefaultServerSocketFactory(); |
489 | | } | | 495 | | } |
490 | | } | | 496 | | } |
491 | | return (this.factory); | | 497 | | return (this.factory); |
492 | | | | 498 | | |
493 | | } | | 499 | | } |
494 | | | | 500 | | |
495 | | | | 501 | | |
496 | | /** | | 502 | | /** |
497 | | * Set the server socket factory used by this Container. | | 503 | | * Set the server socket factory used by this Container. |
498 | | * | | 504 | | * |
499 | | * @param factory The new server socket factory | | 505 | | * @param factory The new server socket factory |
500 | | */ | | 506 | | */ |
501 | | public void setFactory(ServerSocketFactory factory) { | | 507 | | public void setFactory(ServerSocketFactory factory) { |
502 | | | | 508 | | |
503 | | this.factory = factory; | | 509 | | this.factory = factory; |
504 | | | | 510 | | |
505 | | } | | 511 | | } |
506 | | | | 512 | | |
507 | | | | 513 | | |
508 | | /** | | 514 | | /** |
509 | | * Return descriptive information about this Connector implementation. | | 515 | | * Return descriptive information about this Connector implementation. |
510 | | */ | | 516 | | */ |
511 | | public String getInfo() { | | 517 | | public String getInfo() { |
512 | | | | 518 | | |
513 | | return (info); | | 519 | | return (info); |
514 | | | | 520 | | |
515 | | } | | 521 | | } |
516 | | | | 522 | | |
517 | | | | 523 | | |
518 | | /** | | 524 | | /** |
519 | | * Return the minimum number of processors to start at initialization. | | 525 | | * Return the minimum number of processors to start at initialization. |
520 | | */ | | 526 | | */ |
521 | | public int getMinProcessors() { | | 527 | | public int getMinProcessors() { |
522 | | | | 528 | | |
523 | | return (minProcessors); | | 529 | | return (minProcessors); |
524 | | | | 530 | | |
525 | | } | | 531 | | } |
526 | | | | 532 | | |
527 | | | | 533 | | |
528 | | /** | | 534 | | /** |
529 | | * Set the minimum number of processors to start at initialization. | | 535 | | * Set the minimum number of processors to start at initialization. |
530 | | * | | 536 | | * |
531 | | * @param minProcessors The new minimum processors | | 537 | | * @param minProcessors The new minimum processors |
532 | | */ | | 538 | | */ |
533 | | public void setMinProcessors(int minProcessors) { | | 539 | | public void setMinProcessors(int minProcessors) { |
534 | | | | 540 | | |
535 | | this.minProcessors = minProcessors; | | 541 | | this.minProcessors = minProcessors; |
536 | | | | 542 | | |
537 | | } | | 543 | | } |
538 | | | | 544 | | |
539 | | | | 545 | | |
540 | | /** | | 546 | | /** |
541 | | * Return the maximum number of processors allowed, or <0 for unlimited. | | 547 | | * Return the maximum number of processors allowed, or <0 for unlimited. |
542 | | */ | | 548 | | */ |
543 | | public int getMaxProcessors() { | | 549 | | public int getMaxProcessors() { |
544 | | | | 550 | | |
545 | | return (maxProcessors); | | 551 | | return (maxProcessors); |
546 | | | | 552 | | |
547 | | } | | 553 | | } |
548 | | | | 554 | | |
549 | | | | 555 | | |
550 | | /** | | 556 | | /** |
551 | | * Set the maximum number of processors allowed, or <0 for unlimited. | | 557 | | * Set the maximum number of processors allowed, or <0 for unlimited. |
552 | | * | | 558 | | * |
553 | | * @param maxProcessors The new maximum processors | | 559 | | * @param maxProcessors The new maximum processors |
554 | | */ | | 560 | | */ |
555 | | public void setMaxProcessors(int maxProcessors) { | | 561 | | public void setMaxProcessors(int maxProcessors) { |
556 | | | | 562 | | |
557 | | this.maxProcessors = maxProcessors; | | 563 | | this.maxProcessors = maxProcessors; |
558 | | | | 564 | | |
559 | | } | | 565 | | } |
560 | | | | 566 | | |
561 | | | | 567 | | |
562 | | /** | | 568 | | /** |
563 | | * Return the port number on which we listen for HTTP requests. | | 569 | | * Return the port number on which we listen for HTTP requests. |
564 | | */ | | 570 | | */ |
565 | | public int getPort() { | | 571 | | public int getPort() { |
566 | | | | 572 | | |
567 | | return (this.port); | | 573 | | return (this.port); |
568 | | | | 574 | | |
569 | | } | | 575 | | } |
570 | | | | 576 | | |
571 | | | | 577 | | |
572 | | /** | | 578 | | /** |
573 | | * Set the port number on which we listen for HTTP requests. | | 579 | | * Set the port number on which we listen for HTTP requests. |
574 | | * | | 580 | | * |
575 | | * @param port The new port number | | 581 | | * @param port The new port number |
576 | | */ | | 582 | | */ |
577 | | public void setPort(int port) { | | 583 | | public void setPort(int port) { |
578 | | | | 584 | | |
579 | | this.port = port; | | 585 | | this.port = port; |
580 | | | | 586 | | |
581 | | } | | 587 | | } |
582 | | | | 588 | | |
583 | | | | 589 | | |
584 | | /** | | 590 | | /** |
585 | | * Return the proxy server name for this Connector. | | 591 | | * Return the proxy server name for this Connector. |
586 | | */ | | 592 | | */ |
587 | | public String getProxyName() { | | 593 | | public String getProxyName() { |
588 | | | | 594 | | |
589 | | return (this.proxyName); | | 595 | | return (this.proxyName); |
590 | | | | 596 | | |
591 | | } | | 597 | | } |
592 | | | | 598 | | |
593 | | | | 599 | | |
594 | | /** | | 600 | | /** |
595 | | * Set the proxy server name for this Connector. | | 601 | | * Set the proxy server name for this Connector. |
596 | | * | | 602 | | * |
597 | | * @param proxyName The new proxy server name | | 603 | | * @param proxyName The new proxy server name |
598 | | */ | | 604 | | */ |
599 | | public void setProxyName(String proxyName) { | | 605 | | public void setProxyName(String proxyName) { |
600 | | | | 606 | | |
601 | | this.proxyName = proxyName; | | 607 | | this.proxyName = proxyName; |
602 | | | | 608 | | |
603 | | } | | 609 | | } |
604 | | | | 610 | | |
605 | | | | 611 | | |
606 | | /** | | 612 | | /** |
607 | | * Return the proxy server port for this Connector. | | 613 | | * Return the proxy server port for this Connector. |
608 | | */ | | 614 | | */ |
609 | | public int getProxyPort() { | | 615 | | public int getProxyPort() { |
610 | | | | 616 | | |
611 | | return (this.proxyPort); | | 617 | | return (this.proxyPort); |
612 | | | | 618 | | |
613 | | } | | 619 | | } |
614 | | | | 620 | | |
615 | | | | 621 | | |
616 | | /** | | 622 | | /** |
617 | | * Set the proxy server port for this Connector. | | 623 | | * Set the proxy server port for this Connector. |
618 | | * | | 624 | | * |
619 | | * @param proxyPort The new proxy server port | | 625 | | * @param proxyPort The new proxy server port |
620 | | */ | | 626 | | */ |
621 | | public void setProxyPort(int proxyPort) { | | 627 | | public void setProxyPort(int proxyPort) { |
622 | | | | 628 | | |
623 | | this.proxyPort = proxyPort; | | 629 | | this.proxyPort = proxyPort; |
624 | | | | 630 | | |
625 | | } | | 631 | | } |
626 | | | | 632 | | |
627 | | | | 633 | | |
628 | | /** | | 634 | | /** |
629 | | * Return the port number to which a request should be redirected if | | 635 | | * Return the port number to which a request should be redirected if |
630 | | * it comes in on a non-SSL port and is subject to a security constraint | | 636 | | * it comes in on a non-SSL port and is subject to a security constraint |
631 | | * with a transport guarantee that requires SSL. | | 637 | | * with a transport guarantee that requires SSL. |
632 | | */ | | 638 | | */ |
633 | | public int getRedirectPort() { | | 639 | | public int getRedirectPort() { |
634 | | | | 640 | | |
635 | | return (this.redirectPort); | | 641 | | return (this.redirectPort); |
636 | | | | 642 | | |
637 | | } | | 643 | | } |
638 | | | | 644 | | |
639 | | | | 645 | | |
640 | | /** | | 646 | | /** |
641 | | * Set the redirect port number. | | 647 | | * Set the redirect port number. |
642 | | * | | 648 | | * |
643 | | * @param redirectPort The redirect port number (non-SSL to SSL) | | 649 | | * @param redirectPort The redirect port number (non-SSL to SSL) |
644 | | */ | | 650 | | */ |
645 | | public void setRedirectPort(int redirectPort) { | | 651 | | public void setRedirectPort(int redirectPort) { |
646 | | | | 652 | | |
647 | | this.redirectPort = redirectPort; | | 653 | | this.redirectPort = redirectPort; |
648 | | | | 654 | | |
649 | | } | | 655 | | } |
650 | | | | 656 | | |
651 | | | | 657 | | |
652 | | /** | | 658 | | /** |
653 | | * Return the scheme that will be assigned to requests received | | 659 | | * Return the scheme that will be assigned to requests received |
654 | | * through this connector. Default value is "http". | | 660 | | * through this connector. Default value is "http". |
655 | | */ | | 661 | | */ |
656 | | public String getScheme() { | | 662 | | public String getScheme() { |
657 | | | | 663 | | |
658 | | return (this.scheme); | | 664 | | return (this.scheme); |
659 | | | | 665 | | |
660 | | } | | 666 | | } |
661 | | | | 667 | | |
662 | | | | 668 | | |
663 | | /** | | 669 | | /** |
664 | | * Set the scheme that will be assigned to requests received through | | 670 | | * Set the scheme that will be assigned to requests received through |
665 | | * this connector. | | 671 | | * this connector. |
666 | | * | | 672 | | * |
667 | | * @param scheme The new scheme | | 673 | | * @param scheme The new scheme |
668 | | */ | | 674 | | */ |
669 | | public void setScheme(String scheme) { | | 675 | | public void setScheme(String scheme) { |
670 | | | | 676 | | |
671 | | this.scheme = scheme; | | 677 | | this.scheme = scheme; |
672 | | | | 678 | | |
673 | | } | | 679 | | } |
674 | | | | 680 | | |
675 | | | | 681 | | |
676 | | /** | | 682 | | /** |
677 | | * Return the secure connection flag that will be assigned to requests | | 683 | | * Return the secure connection flag that will be assigned to requests |
678 | | * received through this connector. Default value is "false". | | 684 | | * received through this connector. Default value is "false". |
679 | | */ | | 685 | | */ |
680 | | public boolean getSecure() { | | 686 | | public boolean getSecure() { |
681 | | | | 687 | | |
682 | | return (this.secure); | | 688 | | return (this.secure); |
683 | | | | 689 | | |
684 | | } | | 690 | | } |
685 | | | | 691 | | |
686 | | | | 692 | | |
687 | | /** | | 693 | | /** |
688 | | * Set the secure connection flag that will be assigned to requests | | 694 | | * Set the secure connection flag that will be assigned to requests |
689 | | * received through this connector. | | 695 | | * received through this connector. |
690 | | * | | 696 | | * |
691 | | * @param secure The new secure connection flag | | 697 | | * @param secure The new secure connection flag |
692 | | */ | | 698 | | */ |
693 | | public void setSecure(boolean secure) { | | 699 | | public void setSecure(boolean secure) { |
694 | | | | 700 | | |
695 | | this.secure = secure; | | 701 | | this.secure = secure; |
696 | | | | 702 | | |
697 | | } | | 703 | | } |
698 | | | | 704 | | |
699 | | | | 705 | | |
700 | | /** | | 706 | | /** |
701 | | * Return the <code>Service</code> with which we are associated (if any). | | 707 | | * Return the <code>Service</code> with which we are associated (if any). |
702 | | */ | | 708 | | */ |
703 | | public Service getService() { | | 709 | | public Service getService() { |
704 | | | | 710 | | |
705 | | return (this.service); | | 711 | | return (this.service); |
706 | | | | 712 | | |
707 | | } | | 713 | | } |
708 | | | | 714 | | |
709 | | | | 715 | | |
710 | | /** | | 716 | | /** |
711 | | * Set the <code>Service</code> with which we are associated (if any). | | 717 | | * Set the <code>Service</code> with which we are associated (if any). |
712 | | * | | 718 | | * |
713 | | * @param service The service that owns this Engine | | 719 | | * @param service The service that owns this Engine |
714 | | */ | | 720 | | */ |
715 | | public void setService(Service service) { | | 721 | | public void setService(Service service) { |
716 | | | | 722 | | |
717 | | this.service = service; | | 723 | | this.service = service; |
718 | | | | 724 | | |
719 | | } | | 725 | | } |
720 | | | | 726 | | |
721 | | | | 727 | | |
722 | | // --------------------------------------------------------- Public Methods | | 728 | | // --------------------------------------------------------- Public Methods |
723 | | | | 729 | | |
724 | | | | 730 | | |
725 | | /** | | 731 | | /** |
726 | | * Create (or allocate) and return a Request object suitable for | | 732 | | * Create (or allocate) and return a Request object suitable for |
727 | | * specifying the contents of a Request to the responsible Container. | | 733 | | * specifying the contents of a Request to the responsible Container. |
728 | | */ | | 734 | | */ |
729 | | public Request createRequest() { | | 735 | | public Request createRequest() { |
730 | | | | 736 | | |
731 | | HttpRequestImpl request = new HttpRequestImpl(); | | 737 | | HttpRequestImpl request = new HttpRequestImpl(); |
732 | | request.setConnector(this); | | 738 | | request.setConnector(this); |
733 | | return (request); | | 739 | | return (request); |
734 | | | | 740 | | |
735 | | } | | 741 | | } |
736 | | | | 742 | | |
737 | | | | 743 | | |
738 | | /** | | 744 | | /** |
739 | | * Create (or allocate) and return a Response object suitable for | | 745 | | * Create (or allocate) and return a Response object suitable for |
740 | | * receiving the contents of a Response from the responsible Container. | | 746 | | * receiving the contents of a Response from the responsible Container. |
741 | | */ | | 747 | | */ |
742 | | public Response createResponse() { | | 748 | | public Response createResponse() { |
743 | | | | 749 | | |
744 | | HttpResponseImpl response = new HttpResponseImpl(); | | 750 | | HttpResponseImpl response = new HttpResponseImpl(); |
745 | | response.setConnector(this); | | 751 | | response.setConnector(this); |
746 | | return (response); | | 752 | | return (response); |
747 | | | | 753 | | |
748 | | } | | 754 | | } |
749 | | | | 755 | | |
750 | | | | 756 | | |
751 | | // -------------------------------------------------------- Package Methods | | 757 | | // -------------------------------------------------------- Package Methods |
752 | | | | 758 | | |
753 | | | | 759 | | |
754 | | /** | | 760 | | /** |
755 | | * Recycle the specified Processor so that it can be used again. | | 761 | | * Recycle the specified Processor so that it can be used again. |
756 | | * | | 762 | | * |
757 | | * @param processor The processor to be recycled | | 763 | | * @param processor The processor to be recycled |
758 | | */ | | 764 | | */ |
759 | | void recycle(HttpProcessor processor) { | | 765 | | void recycle(HttpProcessor processor) { |
760 | | | | 766 | | |
761 | | processors.push(processor); | | 767 | | processors.push(processor); |
762 | | | | 768 | | |
763 | | } | | 769 | | } |
764 | | | | 770 | | |
765 | | | | 771 | | |
766 | | // -------------------------------------------------------- Private Methods | | 772 | | // -------------------------------------------------------- Private Methods |
767 | | | | 773 | | |
768 | | | | 774 | | |
769 | | /** | | 775 | | /** |
770 | | * Create (or allocate) and return an available processor for use in | | 776 | | * Create (or allocate) and return an available processor for use in |
771 | | * processing a specific HTTP request, if possible. If the maximum | | 777 | | * processing a specific HTTP request, if possible. If the maximum |
772 | | * allowed processors have already been created and are in use, return | | 778 | | * allowed processors have already been created and are in use, return |
773 | | * <code>null</code> instead. | | 779 | | * <code>null</code> instead. |
774 | | */ | | 780 | | */ |
775 | | private HttpProcessor createProcessor() { | | 781 | | private HttpProcessor createProcessor() { |
776 | | | | 782 | | |
777 | | synchronized (processors) { | | 783 | | synchronized (processors) { |
778 | | if (processors.size() > 0) | | 784 | | if (processors.size() > 0) |
779 | | return ((HttpProcessor) processors.pop()); | | 785 | | return ((HttpProcessor) processors.pop()); |
780 | | if ((maxProcessors > 0) && (curProcessors < maxProcessors)) { | | 786 | | if ((maxProcessors > 0) && (curProcessors < maxProcessors)) { |
781 | | return (newProcessor()); | | 787 | | return (newProcessor()); |
782 | | } else { | | 788 | | } else { |
783 | | if (maxProcessors < 0) { | | 789 | | if (maxProcessors < 0) { |
784 | | return (newProcessor()); | | 790 | | return (newProcessor()); |
785 | | } else { | | 791 | | } else { |
786 | | return (null); | | 792 | | return (null); |
787 | | } | | 793 | | } |
788 | | } | | 794 | | } |
789 | | } | | 795 | | } |
790 | | | | 796 | | |
791 | | } | | 797 | | } |
792 | | | | 798 | | |
793 | | | | 799 | | |
794 | | /** | | 800 | | /** |
795 | | * Log a message on the Logger associated with our Container (if any). | | 801 | | * Log a message on the Logger associated with our Container (if any). |
796 | | * | | 802 | | * |
797 | | * @param message Message to be logged | | 803 | | * @param message Message to be logged |
798 | | */ | | 804 | | */ |
799 | | private void log(String message) { | | 805 | | private void log(String message) { |
800 | | | | 806 | | |
801 | | Logger logger = container.getLogger(); | | 807 | | Logger logger = container.getLogger(); |
802 | | String localName = threadName; | | 808 | | String localName = threadName; |
803 | | if (localName == null) | | 809 | | if (localName == null) |
804 | | localName = "HttpConnector"; | | 810 | | localName = "HttpConnector"; |
805 | | if (logger != null) | | 811 | | if (logger != null) |
806 | | logger.log(localName + " " + message); | | 812 | | logger.log(localName + " " + message); |
807 | | else | | 813 | | else |
808 | | System.out.println(localName + " " + message); | | 814 | | System.out.println(localName + " " + message); |
809 | | | | 815 | | |
810 | | } | | 816 | | } |
811 | | | | 817 | | |
812 | | | | 818 | | |
813 | | /** | | 819 | | /** |
814 | | * Log a message on the Logger associated with our Container (if any). | | 820 | | * Log a message on the Logger associated with our Container (if any). |
815 | | * | | 821 | | * |
816 | | * @param message Message to be logged | | 822 | | * @param message Message to be logged |
817 | | * @param throwable Associated exception | | 823 | | * @param throwable Associated exception |
818 | | */ | | 824 | | */ |
819 | | private void log(String message, Throwable throwable) { | | 825 | | private void log(String message, Throwable throwable) { |
820 | | | | 826 | | |
821 | | Logger logger = container.getLogger(); | | 827 | | Logger logger = container.getLogger(); |
822 | | String localName = threadName; | | 828 | | String localName = threadName; |
823 | | if (localName == null) | | 829 | | if (localName == null) |
824 | | localName = "HttpConnector"; | | 830 | | localName = "HttpConnector"; |
825 | | if (logger != null) | | 831 | | if (logger != null) |
826 | | logger.log(localName + " " + message, throwable); | | 832 | | logger.log(localName + " " + message, throwable); |
827 | | else { | | 833 | | else { |
828 | | System.out.println(localName + " " + message); | | 834 | | System.out.println(localName + " " + message); |
829 | | throwable.printStackTrace(System.out); | | 835 | | throwable.printStackTrace(System.out); |
830 | | } | | 836 | | } |
831 | | | | 837 | | |
832 | | } | | 838 | | } |
833 | | | | 839 | | |
834 | | | | 840 | | |
835 | | /** | | 841 | | /** |
836 | | * Create and return a new processor suitable for processing HTTP | | 842 | | * Create and return a new processor suitable for processing HTTP |
837 | | * requests and returning the corresponding responses. | | 843 | | * requests and returning the corresponding responses. |
838 | | */ | | 844 | | */ |
839 | | private HttpProcessor newProcessor() { | | 845 | | private HttpProcessor newProcessor() { |
840 | | | | 846 | | |
841 | | HttpProcessor processor = new HttpProcessor(this, curProcessors++); | | 847 | | HttpProcessor processor = new HttpProcessor(this, curProcessors++); |
842 | | if (processor instanceof Lifecycle) { | | 848 | | if (processor instanceof Lifecycle) { |
843 | | try { | | 849 | | try { |
844 | | ((Lifecycle) processor).start(); | | 850 | | ((Lifecycle) processor).start(); |
845 | | } catch (LifecycleException e) { | | 851 | | } catch (LifecycleException e) { |
846 | | log("newProcessor", e); | | 852 | | log("newProcessor", e); |
847 | | return (null); | | 853 | | return (null); |
848 | | } | | 854 | | } |
849 | | } | | 855 | | } |
850 | | created.addElement(processor); | | 856 | | created.addElement(processor); |
851 | | return (processor); | | 857 | | return (processor); |
852 | | | | 858 | | |
853 | | } | | 859 | | } |
854 | | | | 860 | | |
855 | | | | 861 | | |
856 | | /** | | 862 | | /** |
857 | | * Open and return the server socket for this Connector. If an IP | | 863 | | * Open and return the server socket for this Connector. If an IP |
858 | | * address has been specified, the socket will be opened only on that | | 864 | | * address has been specified, the socket will be opened only on that |
859 | | * address; otherwise it will be opened on all addresses. | | 865 | | * address; otherwise it will be opened on all addresses. |
860 | | * | | 866 | | * |
861 | | * @exception IOException if an input/output err or occurs | | 867 | | * @exception IOException input/output or network erro r |
| | | | 868 | | * @exception KeyStoreException error instantiating the |
| | | | 869 | | * KeyStore from file (SSL only) |
| | | | 870 | | * @exception NoSuchAlgorithmException KeyStore algorithm unsupported |
| | | | 871 | | * by current provider (SSL only) |
| | | | 872 | | * @exception CertificateException general certificate error (SSL only) |
| | | | 873 | | * @exception UnrecoverableKeyException internal KeyStore problem with |
| | | | 874 | | * the certificate (SSL only) |
| | | | 875 | | * @exception KeyManagementException problem in the key management |
| | | | 876 | | * layer (SSL only) |
862 | | */ | | 877 | | */ |
863 | | private ServerSocket open() throws IOException { | | 878 | | private ServerSocket open() |
| | | | 879 | | throws IOException, KeyStoreException, NoSuchAlgorithmException, |
| | | | 880 | | CertificateException, UnrecoverableKeyException, |
| | | | 881 | | KeyManagementException |
| | | | 882 | | { |
864 | | | | 883 | | |
865 | | // Acquire the server socket factory for this Connector | | 884 | | // Acquire the server socket factory for this Connector |
866 | | ServerSocketFactory factory = getFactory(); | | 885 | | ServerSocketFactory factory = getFactory(); |
867 | | | | 886 | | |
868 | | // If no address is specified, open a connection on all addresses | | 887 | | // If no address is specified, open a connection on all addresses |
869 | | if (address == null) { | | 888 | | if (address == null) { |
870 | | log(sm.getString("httpConnector.allAddresses")); | | 889 | | log(sm.getString("httpConnector.allAddresses")); |
871 | | return (factory.createSocket(port, acceptCount)); | | 890 | | return (factory.createSocket(port, acceptCount)); |
872 | | } | | 891 | | } |
873 | | | | 892 | | |
874 | | // Open a server socket on the specified address | | 893 | | // Open a server socket on the specified address |
875 | | InetAddress[] addresses = | | 894 | | InetAddress[] addresses = |
876 | | InetAddress.getAllByName(InetAddress.getLocalHost().getHostName()); | | 895 | | InetAddress.getAllByName(InetAddress.getLocalHost().getHostName()); |
877 | | int i; | | 896 | | int i; |
878 | | for (i = 0; i < addresses.length; i++) { | | 897 | | for (i = 0; i < addresses.length; i++) { |
879 | | if (addresses[i].getHostAddress().equals(address)) | | 898 | | if (addresses[i].getHostAddress().equals(address)) |
880 | | break; | | 899 | | break; |
881 | | } | | 900 | | } |
882 | | if (i < addresses.length) { | | 901 | | if (i < addresses.length) { |
883 | | log(sm.getString("httpConnector.anAddress", address)); | | 902 | | log(sm.getString("httpConnector.anAddress", address)); |
884 | | return (factory.createSocket(port, acceptCount, addresses[i])); | | 903 | | return (factory.createSocket(port, acceptCount, addresses[i])); |
885 | | } else { | | 904 | | } else { |
886 | | log(sm.getString("httpConnector.noAddress", address)); | | 905 | | log(sm.getString("httpConnector.noAddress", address)); |
887 | | return (factory.createSocket(port, acceptCount)); | | 906 | | return (factory.createSocket(port, acceptCount)); |
888 | | } | | 907 | | } |
889 | | | | 908 | | |
890 | | } | | 909 | | } |
891 | | | | 910 | | |
892 | | | | 911 | | |
893 | | // ---------------------------------------------- Background Thread Methods | | 912 | | // ---------------------------------------------- Background Thread Methods |
894 | | | | 913 | | |
895 | | | | 914 | | |
896 | | /** | | 915 | | /** |
897 | | * The background thread that listens for incoming TCP/IP connections and | | 916 | | * The background thread that listens for incoming TCP/IP connections and |
898 | | * hands them off to an appropriate processor. | | 917 | | * hands them off to an appropriate processor. |
899 | | */ | | 918 | | */ |
900 | | public void run() { | | 919 | | public void run() { |
901 | | | | 920 | | |
902 | | // Loop until we receive a shutdown command | | 921 | | // Loop until we receive a shutdown command |
903 | | while (!stopped) { | | 922 | | while (!stopped) { |
904 | | | | 923 | | |
905 | | // Accept the next incoming connection from the server socket | | 924 | | // Accept the next incoming connection from the server socket |
906 | | Socket socket = null; | | 925 | | Socket socket = null; |
907 | | try { | | 926 | | try { |
908 | | socket = serverSocket.accept(); | | 927 | | socket = serverSocket.accept(); |
909 | | if (connectionTimeout > 0) | | 928 | | if (connectionTimeout > 0) |
910 | | socket.setSoTimeout(connectionTimeout); | | 929 | | socket.setSoTimeout(connectionTimeout); |
911 | | } catch (AccessControlException ace) { | | 930 | | } catch (AccessControlException ace) { |
912 | | log("socket accept security exception: " + ace.getMessage()); | | 931 | | log("socket accept security exception: " + ace.getMessage()); |
913 | | continue; | | 932 | | continue; |
914 | | } catch (IOException e) { | | 933 | | } catch (IOException e) { |
915 | | if (started && !stopped) | | 934 | | if (started && !stopped) |
916 | | log("accept: ", e); | | 935 | | log("accept: ", e); |
917 | | break; | | 936 | | break; |
918 | | } | | 937 | | } |
919 | | | | 938 | | |
920 | | // Hand this socket off to an appropriate processor | | 939 | | // Hand this socket off to an appropriate processor |
921 | | HttpProcessor processor = createProcessor(); | | 940 | | HttpProcessor processor = createProcessor(); |
922 | | if (processor == null) { | | 941 | | if (processor == null) { |
923 | | try { | | 942 | | try { |
924 | | log(sm.getString("httpConnector.noProcessor")); | | 943 | | log(sm.getString("httpConnector.noProcessor")); |
925 | | socket.close(); | | 944 | | socket.close(); |
926 | | } catch (IOException e) { | | 945 | | } catch (IOException e) { |
927 | | ; | | 946 | | ; |
928 | | } | | 947 | | } |
929 | | continue; | | 948 | | continue; |
930 | | } | | 949 | | } |
931 | | processor.assign(socket); | | 950 | | processor.assign(socket); |
932 | | | | 951 | | |
933 | | // The processor will recycle itself when it finishes | | 952 | | // The processor will recycle itself when it finishes |
934 | | | | 953 | | |
935 | | } | | 954 | | } |
936 | | | | 955 | | |
937 | | // Notify the threadStop() method that we have shut ourselves down | | 956 | | // Notify the threadStop() method that we have shut ourselves down |
938 | | synchronized (threadSync) { | | 957 | | synchronized (threadSync) { |
939 | | threadSync.notifyAll(); | | 958 | | threadSync.notifyAll(); |
940 | | } | | 959 | | } |
941 | | | | 960 | | |
942 | | } | | 961 | | } |
943 | | | | 962 | | |
944 | | | | 963 | | |
945 | | /** | | 964 | | /** |
946 | | * Start the background processing thread. | | 965 | | * Start the background processing thread. |
947 | | */ | | 966 | | */ |
948 | | private void threadStart() { | | 967 | | private void threadStart() { |
949 | | | | 968 | | |
950 | | log(sm.getString("httpConnector.starting")); | | 969 | | log(sm.getString("httpConnector.starting")); |
951 | | | | 970 | | |
952 | | thread = new Thread(this, threadName); | | 971 | | thread = new Thread(this, threadName); |
953 | | thread.setDaemon(true); | | 972 | | thread.setDaemon(true); |
954 | | thread.start(); | | 973 | | thread.start(); |
955 | | | | 974 | | |
956 | | } | | 975 | | } |
957 | | | | 976 | | |
958 | | | | 977 | | |
959 | | /** | | 978 | | /** |
960 | | * Stop the background processing thread. | | 979 | | * Stop the background processing thread. |
961 | | */ | | 980 | | */ |
962 | | private void threadStop() { | | 981 | | private void threadStop() { |
963 | | | | 982 | | |
964 | | log(sm.getString("httpConnector.stopping")); | | 983 | | log(sm.getString("httpConnector.stopping")); |
965 | | | | 984 | | |
966 | | stopped = true; | | 985 | | stopped = true; |
967 | | synchronized (threadSync) { | | 986 | | synchronized (threadSync) { |
968 | | try { | | 987 | | try { |
969 | | threadSync.wait(5000); | | 988 | | threadSync.wait(5000); |
970 | | } catch (InterruptedException e) { | | 989 | | } catch (InterruptedException e) { |
971 | | ; | | 990 | | ; |
972 | | } | | 991 | | } |
973 | | } | | 992 | | } |
974 | | thread = null; | | 993 | | thread = null; |
975 | | | | 994 | | |
976 | | } | | 995 | | } |
977 | | | | 996 | | |
978 | | | | 997 | | |
979 | | // ------------------------------------------------------ Lifecycle Methods | | 998 | | // ------------------------------------------------------ Lifecycle Methods |
980 | | | | 999 | | |
981 | | | | 1000 | | |
982 | | /** | | 1001 | | /** |
983 | | * Add a lifecycle event listener to this component. | | 1002 | | * Add a lifecycle event listener to this component. |
984 | | * | | 1003 | | * |
985 | | * @param listener The listener to add | | 1004 | | * @param listener The listener to add |
986 | | */ | | 1005 | | */ |
987 | | public void addLifecycleListener(LifecycleListener listener) { | | 1006 | | public void addLifecycleListener(LifecycleListener listener) { |
988 | | | | 1007 | | |
989 | | lifecycle.addLifecycleListener(listener); | | 1008 | | lifecycle.addLifecycleListener(listener); |
990 | | | | 1009 | | |
991 | | } | | 1010 | | } |
992 | | | | 1011 | | |
993 | | | | 1012 | | |
994 | | /** | | 1013 | | /** |
| | | | 1014 | | * Get the lifecycle listeners associated with this lifecycle. If this |
| | | | 1015 | | * Lifecycle has no listeners registered, a zero-length array is returned. |
| | | | 1016 | | */ |
| | | | 1017 | | public LifecycleListener[] findLifecycleListeners() { |
| | | | 1018 | | |
| | | | 1019 | | return lifecycle.findLifecycleListeners(); |
| | | | 1020 | | |
| | | | 1021 | | } |
| | | | 1022 | | |
| | | | 1023 | | |
| | | | 1024 | | /** |
995 | | * Remove a lifecycle event listener from this component. | | 1025 | | * Remove a lifecycle event listener from this component. |
996 | | * | | 1026 | | * |
997 | | * @param listener The listener to add | | 1027 | | * @param listener The listener to add |
998 | | */ | | 1028 | | */ |
999 | | public void removeLifecycleListener(LifecycleListener listener) { | | 1029 | | public void removeLifecycleListener(LifecycleListener listener) { |
1000 | | | | 1030 | | |
1001 | | lifecycle.removeLifecycleListener(listener); | | 1031 | | lifecycle.removeLifecycleListener(listener); |
1002 | | | | 1032 | | |
1003 | | } | | 1033 | | } |
1004 | | | | 1034 | | |
1005 | | | | 1035 | | |
1006 | | /** | | 1036 | | /** |
1007 | | * Initialize this connector (create ServerSocket here!) | | 1037 | | * Initialize this connector (create ServerSocket here!) |
1008 | | */ | | 1038 | | */ |
1009 | | public void initialize() | | 1039 | | public void initialize() |
1010 | | throws LifecycleException { | | 1040 | | throws LifecycleException { |
1011 | | if (initialized) | | 1041 | | if (initialized) |
1012 | | throw new LifecycleException ( | | 1042 | | throw new LifecycleException ( |
1013 | | sm.getString("httpConnector.alreadyInitialized")); | | 1043 | | sm.getString("httpConnector.alreadyInitialized")); |
| | | | 1044 | | |
1014 | | this.initialized=true; | | 1045 | | this.initialized=true; |
| | | | 1046 | | Exception eRethrow = null; |
1015 | | | | 1047 | | |
1016 | | // Establish a server socket on the specified port | | 1048 | | // Establish a server socket on the specified port |
1017 | | try { | | 1049 | | try { |
1018 | | serverSocket = open(); | | 1050 | | serverSocket = open(); |
1019 | | } catch (IOException e) { | | 1051 | | } catch (IOException ioe) { |
1020 | | throw new LifecycleException(threadName + ".o p en", e); | | 1052 | | log("httpConne c t o r, io problem: ", ioe); |
| | | | 1053 | | eRethrow = ioe; |
| | | | 1054 | | } catch (KeyStoreException kse) { |
| | | | 1055 | | log("httpConnector, keystore problem: ", kse); |
| | | | 1056 | | eRethrow = kse; |
| | | | 1057 | | } catch (NoSuchAlgorithmException nsae) { |
| | | | 1058 | | log("httpConnector, keystore algorithm problem: ", nsae); |
| | | | 1059 | | eRethrow = nsae; |
| | | | 1060 | | } catch (CertificateException ce) { |
| | | | 1061 | | log("httpConnector, certificate problem: ", ce); |
| | | | 1062 | | eRethrow = ce; |
| | | | 1063 | | } catch (UnrecoverableKeyException uke) { |
| | | | 1064 | | log("httpConnector, unrecoverable key: ", uke); |
| | | | 1065 | | eRethrow = uke; |
| | | | 1066 | | } catch (KeyManagementException kme) { |
| | | | 1067 | | log("httpConnector, key management problem: ", kme); |
| | | | 1068 | | eRethrow = kme; |
1021 | | } | | 1069 | | } |
1022 | | | | 1070 | | |
| | | | 1071 | | if ( eRethrow != null ) |
| | | | 1072 | | throw new LifecycleException(threadName + ".open", eRethrow); |
| | | | 1073 | | |
1023 | | } | | 1074 | | } |
1024 | | | | 1075 | | |
1025 | | /** | | 1076 | | /** |
1026 | | * Begin processing requests via this Connector. | | 1077 | | * Begin processing requests via this Connector. |
1027 | | * | | 1078 | | * |
1028 | | * @exception LifecycleException if a fatal startup error occurs | | 1079 | | * @exception LifecycleException if a fatal startup error occurs |
1029 | | */ | | 1080 | | */ |
1030 | | public void start() throws LifecycleException { | | 1081 | | public void start() throws LifecycleException { |
1031 | | | | 1082 | | |
1032 | | // Validate and update our current state | | 1083 | | // Validate and update our current state |
1033 | | if (started) | | 1084 | | if (started) |
1034 | | throw new LifecycleException | | 1085 | | throw new LifecycleException |
1035 | | (sm.getString("httpConnector.alreadyStarted")); | | 1086 | | (sm.getString("httpConnector.alreadyStarted")); |
1036 | | threadName = "HttpConnector[" + port + "]"; | | 1087 | | threadName = "HttpConnector[" + port + "]"; |
1037 | | lifecycle.fireLifecycleEvent(START_EVENT, null); | | 1088 | | lifecycle.fireLifecycleEvent(START_EVENT, null); |
1038 | | started = true; | | 1089 | | started = true; |
1039 | | | | 1090 | | |
1040 | | // Start our background thread | | 1091 | | // Start our background thread |
1041 | | threadStart(); | | 1092 | | threadStart(); |
1042 | | | | 1093 | | |
1043 | | // Create the specified minimum number of processors | | 1094 | | // Create the specified minimum number of processors |
1044 | | while (curProcessors < minProcessors) { | | 1095 | | while (curProcessors < minProcessors) { |
1045 | | if ((maxProcessors > 0) && (curProcessors >= maxProcessors)) | | 1096 | | if ((maxProcessors > 0) && (curProcessors >= maxProcessors)) |
1046 | | break; | | 1097 | | break; |
1047 | | HttpProcessor processor = newProcessor(); | | 1098 | | HttpProcessor processor = newProcessor(); |
1048 | | recycle(processor); | | 1099 | | recycle(processor); |
1049 | | } | | 1100 | | } |
1050 | | | | 1101 | | |
1051 | | } | | 1102 | | } |
1052 | | | | 1103 | | |
1053 | | | | 1104 | | |
1054 | | /** | | 1105 | | /** |
1055 | | * Terminate processing requests via this Connector. | | 1106 | | * Terminate processing requests via this Connector. |
1056 | | * | | 1107 | | * |
1057 | | * @exception LifecycleException if a fatal shutdown error occurs | | 1108 | | * @exception LifecycleException if a fatal shutdown error occurs |
1058 | | */ | | 1109 | | */ |
1059 | | public void stop() throws LifecycleException { | | 1110 | | public void stop() throws LifecycleException { |
1060 | | | | 1111 | | |
1061 | | // Validate and update our current state | | 1112 | | // Validate and update our current state |
1062 | | if (!started) | | 1113 | | if (!started) |
1063 | | throw new LifecycleException | | 1114 | | throw new LifecycleException |
1064 | | (sm.getString("httpConnector.notStarted")); | | 1115 | | (sm.getString("httpConnector.notStarted")); |
1065 | | lifecycle.fireLifecycleEvent(STOP_EVENT, null); | | 1116 | | lifecycle.fireLifecycleEvent(STOP_EVENT, null); |
1066 | | started = false; | | 1117 | | started = false; |
1067 | | | | 1118 | | |
1068 | | // Gracefully shut down all processors we have created | | 1119 | | // Gracefully shut down all processors we have created |
1069 | | for (int i = created.size() - 1; i >= 0; i--) { | | 1120 | | for (int i = created.size() - 1; i >= 0; i--) { |
1070 | | HttpProcessor processor = (HttpProcessor) created.elementAt(i); | | 1121 | | HttpProcessor processor = (HttpProcessor) created.elementAt(i); |
1071 | | if (processor instanceof Lifecycle) { | | 1122 | | if (processor instanceof Lifecycle) { |
1072 | | try { | | 1123 | | try { |
1073 | | ((Lifecycle) processor).stop(); | | 1124 | | ((Lifecycle) processor).stop(); |
1074 | | } catch (LifecycleException e) { | | 1125 | | } catch (LifecycleException e) { |
1075 | | log("HttpConnector.stop", e); | | 1126 | | log("HttpConnector.stop", e); |
1076 | | } | | 1127 | | } |
1077 | | } | | 1128 | | } |
1078 | | } | | 1129 | | } |
1079 | | | | 1130 | | |
1080 | | // Close the server socket we were using | | 1131 | | // Close the server socket we were using |
1081 | | if (serverSocket != null) { | | 1132 | | if (serverSocket != null) { |
1082 | | try { | | 1133 | | try { |
1083 | | serverSocket.close(); | | 1134 | | serverSocket.close(); |
1084 | | } catch (IOException e) { | | 1135 | | } catch (IOException e) { |
1085 | | ; | | 1136 | | ; |
1086 | | } | | 1137 | | } |
1087 | | serverSocket = null; | | 1138 | | serverSocket = null; |
1088 | | } | | 1139 | | } |
1089 | | | | 1140 | | |
1090 | | // Stop our background thread | | 1141 | | // Stop our background thread |
1091 | | threadStop(); | | 1142 | | threadStop(); |
1092 | | | | 1143 | | |
1093 | | } | | 1144 | | } |
1094 | | | | 1145 | | |
1095 | | | | 1146 | | |
1096 | | } | | 1147 | | } |