Mercurial Hosting > luan
annotate src/org/eclipse/jetty/server/Connector.java @ 1001:39154cfa58e4
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 22 Oct 2016 20:56:41 -0600 |
parents | d9cfec64899c |
children | 0e96ce3db20a |
rev | line source |
---|---|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
1 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
2 // ======================================================================== |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
4 // ------------------------------------------------------------------------ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
5 // All rights reserved. This program and the accompanying materials |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
6 // are made available under the terms of the Eclipse Public License v1.0 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
7 // and Apache License v2.0 which accompanies this distribution. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
8 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
9 // The Eclipse Public License is available at |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
10 // http://www.eclipse.org/legal/epl-v10.html |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
11 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
12 // The Apache License v2.0 is available at |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
13 // http://www.opensource.org/licenses/apache2.0.php |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
14 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
15 // You may elect to redistribute this code under either of these licenses. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
16 // ======================================================================== |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
17 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
18 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
19 package org.eclipse.jetty.server; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
20 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
21 import java.io.IOException; |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
22 import java.net.InetAddress; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
23 import java.net.Socket; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
24 import java.net.UnknownHostException; |
909 | 25 import java.nio.channels.ServerSocketChannel; |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
26 import java.util.concurrent.ThreadPoolExecutor; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
27 import java.util.concurrent.atomic.AtomicLong; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
28 |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
29 import javax.servlet.ServletRequest; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
30 |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
31 import org.eclipse.jetty.http.HttpBuffers; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
32 import org.eclipse.jetty.http.HttpBuffersImpl; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
33 import org.eclipse.jetty.http.HttpFields; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
34 import org.eclipse.jetty.http.HttpHeaders; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
35 import org.eclipse.jetty.http.HttpSchemes; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
36 import org.eclipse.jetty.io.Buffers; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
37 import org.eclipse.jetty.io.Buffers.Type; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
38 import org.eclipse.jetty.io.EndPoint; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
39 import org.eclipse.jetty.io.EofException; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
40 import org.eclipse.jetty.util.component.AggregateLifeCycle; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
41 import org.eclipse.jetty.util.component.Dumpable; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
42 import org.slf4j.Logger; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
43 import org.slf4j.LoggerFactory; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
44 |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
45 /** |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
46 * Abstract Connector implementation. This abstract implementation of the Connector interface provides: |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
47 * <ul> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
48 * <li>AbstractLifeCycle implementation</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
49 * <li>Implementations for connector getters and setters</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
50 * <li>Buffer management</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
51 * <li>Socket configuration</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
52 * <li>Base acceptor thread</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
53 * <li>Optional reverse proxy headers checking</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
54 * </ul> |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
55 */ |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
56 public abstract class Connector extends AggregateLifeCycle implements HttpBuffers, Dumpable, Runnable |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
57 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
58 private static final Logger LOG = LoggerFactory.getLogger(Connector.class); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
59 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
60 private String _name; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
61 |
887
df84a1741687
make Connector reference to server explicit
Franklin Schmidt <fschmidt@gmail.com>
parents:
885
diff
changeset
|
62 public final Server server; |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
63 private String _host; |
887
df84a1741687
make Connector reference to server explicit
Franklin Schmidt <fschmidt@gmail.com>
parents:
885
diff
changeset
|
64 public final int port; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
65 |
948
f5aefdc4a81a
simplify SelectChannelConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
914
diff
changeset
|
66 protected final int _maxIdleTime = 200000; |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
67 protected int _soLingerTime = -1; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
68 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
69 protected final HttpBuffersImpl _buffers = new HttpBuffersImpl(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
70 |
909 | 71 // from child classes |
72 protected transient ServerSocketChannel _acceptChannel; | |
73 | |
996 | 74 protected Connector(Server server,int port) { |
887
df84a1741687
make Connector reference to server explicit
Franklin Schmidt <fschmidt@gmail.com>
parents:
885
diff
changeset
|
75 this.server = server; |
df84a1741687
make Connector reference to server explicit
Franklin Schmidt <fschmidt@gmail.com>
parents:
885
diff
changeset
|
76 this.port = port; |
df84a1741687
make Connector reference to server explicit
Franklin Schmidt <fschmidt@gmail.com>
parents:
885
diff
changeset
|
77 server.connectors.add(this); |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
78 addBean(_buffers); |
907
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
79 _buffers.setRequestBufferType(Type.DIRECT); |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
80 _buffers.setRequestHeaderType(Type.INDIRECT); |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
81 _buffers.setResponseBufferType(Type.DIRECT); |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
82 _buffers.setResponseHeaderType(Type.INDIRECT); |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
83 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
84 |
996 | 85 public final void setHost(String host) |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
86 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
87 _host = host; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
88 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
89 |
996 | 90 public final String getHost() |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
91 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
92 return _host; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
93 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
94 |
996 | 95 public final int getMaxIdleTime() |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
96 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
97 return _maxIdleTime; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
98 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
99 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
100 /* ------------------------------------------------------------ */ |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
101 /** |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
102 * Set the maximum Idle time for a connection, which roughly translates to the {@link Socket#setSoTimeout(int)} call, although with NIO implementations |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
103 * other mechanisms may be used to implement the timeout. The max idle time is applied: |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
104 * <ul> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
105 * <li>When waiting for a new request to be received on a connection</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
106 * <li>When reading the headers and content of a request</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
107 * <li>When writing the headers and content of a response</li> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
108 * </ul> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
109 * Jetty interprets this value as the maximum time between some progress being made on the connection. So if a single byte is read or written, then the |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
110 * timeout (if implemented by jetty) is reset. However, in many instances, the reading/writing is delegated to the JVM, and the semantic is more strictly |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
111 * enforced as the maximum time a single read/write operation can take. Note, that as Jetty supports writes of memory mapped file buffers, then a write may |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
112 * take many 10s of seconds for large content written to a slow device. |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
113 * <p> |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
114 * Previously, Jetty supported separate idle timeouts and IO operation timeouts, however the expense of changing the value of soTimeout was significant, so |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
115 * these timeouts were merged. With the advent of NIO, it may be possible to again differentiate these values (if there is demand). |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
116 * |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
117 * @param maxIdleTime |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
118 * The maxIdleTime to set. |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
119 */ |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
120 |
996 | 121 public final int getSoLingerTime() |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
122 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
123 return _soLingerTime; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
124 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
125 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
126 /* ------------------------------------------------------------ */ |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
127 /** |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
128 * @param soLingerTime |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
129 * The soLingerTime to set or -1 to disable. |
818
ad292e148964
remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
130 */ |
996 | 131 public final void setSoLingerTime(int soLingerTime) |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
132 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
133 _soLingerTime = soLingerTime; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
134 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
135 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
136 @Override |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
137 protected void doStart() throws Exception |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
138 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
139 super.doStart(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
140 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
141 // Start selector thread |
905
e7175965e6cf
remove Connector._acceptorThreads
Franklin Schmidt <fschmidt@gmail.com>
parents:
904
diff
changeset
|
142 ThreadPoolExecutor _threadPool = server.threadPool; |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
143 _threadPool.execute(this); |
905
e7175965e6cf
remove Connector._acceptorThreads
Franklin Schmidt <fschmidt@gmail.com>
parents:
904
diff
changeset
|
144 if (server.isLowOnThreads()) |
e7175965e6cf
remove Connector._acceptorThreads
Franklin Schmidt <fschmidt@gmail.com>
parents:
904
diff
changeset
|
145 LOG.warn("insufficient threads configured for {}",this); |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
146 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
147 LOG.info("Started {}",this); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
148 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
149 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
150 @Override |
913 | 151 protected synchronized void doStop() throws Exception |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
152 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
153 try |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
154 { |
913 | 155 if (_acceptChannel != null) |
156 _acceptChannel.close(); | |
157 _acceptChannel=null; | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
158 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
159 catch (IOException e) |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
160 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
161 LOG.warn("",e); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
162 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
163 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
164 super.doStop(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
165 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
166 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
167 |
914
54308d65265a
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
913
diff
changeset
|
168 protected final void configure(Socket socket) throws IOException |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
169 { |
914
54308d65265a
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
913
diff
changeset
|
170 socket.setTcpNoDelay(true); |
54308d65265a
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
913
diff
changeset
|
171 if (_soLingerTime >= 0) |
54308d65265a
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
913
diff
changeset
|
172 socket.setSoLinger(true,_soLingerTime / 1000); |
54308d65265a
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
913
diff
changeset
|
173 else |
54308d65265a
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
913
diff
changeset
|
174 socket.setSoLinger(false,0); |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
175 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
176 |
1001 | 177 public abstract void customize(AbstractHttpConnection con) throws IOException; |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
178 |
972
5ee36654b383
simplify AbstractHttpConnection
Franklin Schmidt <fschmidt@gmail.com>
parents:
956
diff
changeset
|
179 public boolean isConfidential() |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
180 { |
889 | 181 return false; |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
182 } |
818
ad292e148964
remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
183 |
906 | 184 protected abstract void accept() throws IOException, InterruptedException; |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
185 |
996 | 186 @Override |
187 public final int getRequestBufferSize() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
188 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
189 return _buffers.getRequestBufferSize(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
190 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
191 |
996 | 192 @Override |
193 public final void setRequestBufferSize(int requestBufferSize) | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
194 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
195 _buffers.setRequestBufferSize(requestBufferSize); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
196 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
197 |
996 | 198 @Override |
199 public final int getRequestHeaderSize() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
200 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
201 return _buffers.getRequestHeaderSize(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
202 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
203 |
996 | 204 @Override |
205 public final void setRequestHeaderSize(int requestHeaderSize) | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
206 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
207 _buffers.setRequestHeaderSize(requestHeaderSize); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
208 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
209 |
996 | 210 @Override |
211 public final int getResponseBufferSize() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
212 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
213 return _buffers.getResponseBufferSize(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
214 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
215 |
996 | 216 @Override |
217 public final void setResponseBufferSize(int responseBufferSize) | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
218 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
219 _buffers.setResponseBufferSize(responseBufferSize); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
220 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
221 |
996 | 222 @Override |
223 public final int getResponseHeaderSize() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
224 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
225 return _buffers.getResponseHeaderSize(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
226 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
227 |
996 | 228 @Override |
229 public final void setResponseHeaderSize(int responseHeaderSize) | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
230 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
231 _buffers.setResponseHeaderSize(responseHeaderSize); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
232 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
233 |
996 | 234 @Override |
235 public final Type getRequestBufferType() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
236 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
237 return _buffers.getRequestBufferType(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
238 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
239 |
996 | 240 @Override |
241 public final Type getRequestHeaderType() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
242 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
243 return _buffers.getRequestHeaderType(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
244 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
245 |
996 | 246 @Override |
247 public final Type getResponseBufferType() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
248 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
249 return _buffers.getResponseBufferType(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
250 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
251 |
996 | 252 @Override |
253 public final Type getResponseHeaderType() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
254 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
255 return _buffers.getResponseHeaderType(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
256 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
257 |
996 | 258 @Override |
259 public final void setRequestBuffers(Buffers requestBuffers) | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
260 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
261 _buffers.setRequestBuffers(requestBuffers); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
262 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
263 |
996 | 264 @Override |
265 public final void setResponseBuffers(Buffers responseBuffers) | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
266 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
267 _buffers.setResponseBuffers(responseBuffers); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
268 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
269 |
996 | 270 @Override |
271 public final Buffers getRequestBuffers() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
272 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
273 return _buffers.getRequestBuffers(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
274 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
275 |
996 | 276 @Override |
277 public final Buffers getResponseBuffers() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
278 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
279 return _buffers.getResponseBuffers(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
280 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
281 |
996 | 282 @Override |
283 public final int getMaxBuffers() | |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
284 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
285 return _buffers.getMaxBuffers(); |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
286 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
287 |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
288 @Override |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
289 public String toString() |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
290 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
291 return String.format("%s@%s:%d", |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
292 getClass().getSimpleName(), |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
293 getHost()==null?"0.0.0.0":getHost(), |
909 | 294 port); |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
295 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
296 |
909 | 297 |
996 | 298 @Override |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
299 public void run() |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
300 { |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
301 Thread current = Thread.currentThread(); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
302 String name = current.getName(); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
303 current.setName(name + " Acceptor" + " " + Connector.this); |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
304 |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
305 try |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
306 { |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
307 while (isRunning() && _acceptChannel != null) |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
308 { |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
309 try |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
310 { |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
311 accept(); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
312 } |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
313 catch (EofException e) |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
314 { |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
315 LOG.trace("",e); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
316 } |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
317 catch (IOException e) |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
318 { |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
319 LOG.trace("",e); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
320 } |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
321 catch (InterruptedException x) |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
322 { |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
323 // Connector has been stopped |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
324 LOG.trace("",x); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
325 } |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
326 catch (Throwable e) |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
327 { |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
328 LOG.warn("",e); |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
329 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
330 } |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
331 } |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
332 finally |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
333 { |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
948
diff
changeset
|
334 current.setName(name); |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
335 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
336 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
337 |
996 | 338 public final String getName() |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
339 { |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
340 if (_name == null) |
909 | 341 _name = (getHost() == null?"0.0.0.0":getHost()) + ":" + port; |
885
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
342 return _name; |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
343 } |
150092cebf3e
remove AbstractConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
344 |
907
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
345 |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
346 // from AbstractNIOConnector |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
347 |
996 | 348 public final boolean getUseDirectBuffers() |
907
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
349 { |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
350 return getRequestBufferType()==Type.DIRECT; |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
351 } |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
352 |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
353 /* ------------------------------------------------------------------------------- */ |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
354 /** |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
355 * @param direct If True (the default), the connector can use NIO direct buffers. |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
356 * Some JVMs have memory management issues (bugs) with direct buffers. |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
357 */ |
996 | 358 public final void setUseDirectBuffers(boolean direct) |
907
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
359 { |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
360 _buffers.setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT); |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
361 _buffers.setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT); |
bc4e299de953
remove AbstractNIOConnector
Franklin Schmidt <fschmidt@gmail.com>
parents:
906
diff
changeset
|
362 } |
909 | 363 |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
364 } |