Mercurial Hosting > luan
comparison src/org/eclipse/jetty/server/AsyncHttpConnection.java @ 972:5ee36654b383
simplify AbstractHttpConnection
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 15 Oct 2016 22:42:05 -0600 |
parents | 866f2e801618 |
children | d35b0a3a7a4a |
comparison
equal
deleted
inserted
replaced
971:f997df37cec1 | 972:5ee36654b383 |
---|---|
21 import java.io.IOException; | 21 import java.io.IOException; |
22 | 22 |
23 import org.eclipse.jetty.http.HttpException; | 23 import org.eclipse.jetty.http.HttpException; |
24 import org.eclipse.jetty.http.HttpStatus; | 24 import org.eclipse.jetty.http.HttpStatus; |
25 import org.eclipse.jetty.io.AsyncEndPoint; | 25 import org.eclipse.jetty.io.AsyncEndPoint; |
26 import org.eclipse.jetty.io.Connection; | |
27 import org.eclipse.jetty.io.EndPoint; | 26 import org.eclipse.jetty.io.EndPoint; |
28 import org.eclipse.jetty.io.nio.AsyncConnection; | 27 import org.eclipse.jetty.io.nio.AsyncConnection; |
29 import org.eclipse.jetty.io.nio.SelectChannelEndPoint; | 28 import org.eclipse.jetty.io.nio.SelectChannelEndPoint; |
29 import org.eclipse.jetty.server.nio.SelectChannelConnector; | |
30 import org.slf4j.Logger; | 30 import org.slf4j.Logger; |
31 import org.slf4j.LoggerFactory; | 31 import org.slf4j.LoggerFactory; |
32 | 32 |
33 | 33 |
34 /* ------------------------------------------------------------ */ | 34 /* ------------------------------------------------------------ */ |
35 /** Asychronous Server HTTP connection | 35 /** Asychronous Server HTTP connection |
36 * | 36 * |
37 */ | 37 */ |
38 public class AsyncHttpConnection extends AbstractHttpConnection implements AsyncConnection | 38 public final class AsyncHttpConnection extends AbstractHttpConnection implements AsyncConnection |
39 { | 39 { |
40 private final static int NO_PROGRESS_INFO = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_INFO",100); | 40 private final static int NO_PROGRESS_INFO = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_INFO",100); |
41 private final static int NO_PROGRESS_CLOSE = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_CLOSE",200); | 41 private final static int NO_PROGRESS_CLOSE = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_CLOSE",200); |
42 | 42 |
43 private static final Logger LOG = LoggerFactory.getLogger(AsyncHttpConnection.class); | 43 private static final Logger LOG = LoggerFactory.getLogger(AsyncHttpConnection.class); |
44 private int _total_no_progress; | 44 private int _total_no_progress; |
45 private final AsyncEndPoint _asyncEndp; | 45 private final AsyncEndPoint _asyncEndp; |
46 private boolean _readInterested = true; | 46 private boolean _readInterested = true; |
47 | 47 |
48 public AsyncHttpConnection(Connector connector, EndPoint endpoint, Server server) | 48 public AsyncHttpConnection(SelectChannelConnector connector, AsyncEndPoint endpoint) |
49 { | 49 { |
50 super(connector,endpoint,server); | 50 super(connector,endpoint); |
51 _asyncEndp=(AsyncEndPoint)endpoint; | 51 _asyncEndp = endpoint; |
52 } | 52 } |
53 | 53 |
54 @Override | 54 @Override |
55 public void handle() throws IOException | 55 public void handle() throws IOException |
56 { | 56 { |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 @Override | |
158 public void onInputShutdown() throws IOException | 159 public void onInputShutdown() throws IOException |
159 { | 160 { |
160 // If we don't have a committed response and we are not suspended | 161 // If we don't have a committed response and we are not suspended |
161 if (_generator.isIdle()) | 162 if (_generator.isIdle()) |
162 { | 163 { |
168 if (_parser.isIdle()) | 169 if (_parser.isIdle()) |
169 _parser.setPersistent(false); | 170 _parser.setPersistent(false); |
170 } | 171 } |
171 | 172 |
172 @Override | 173 @Override |
173 public void reset() | 174 protected void reset() |
174 { | 175 { |
175 _readInterested = true; | 176 _readInterested = true; |
176 LOG.debug("Enabled read interest {}", _endp); | 177 LOG.debug("Enabled read interest {}", _endp); |
177 super.reset(); | 178 super.reset(); |
178 } | 179 } |
179 | 180 |
180 @Override | 181 @Override |
181 public boolean isSuspended() | 182 public boolean isSuspended() |
182 { | 183 { |
183 return !_readInterested || super.isSuspended(); | 184 return !_readInterested; |
184 } | 185 } |
185 } | 186 } |