diff options
author | Greg Wilkins | 2012-12-13 22:50:22 +0000 |
---|---|---|
committer | Greg Wilkins | 2012-12-13 22:50:22 +0000 |
commit | 6bfc19be1babd9e62338ab538dac0ff9684f51e0 (patch) | |
tree | cd69d67e86a727f0a6911b92b0d36cc3b75622cc /jetty-server/src/main/java | |
parent | 5b8a9bb95e0bec732fd2c2a383a1f73d116fb8d0 (diff) | |
download | org.eclipse.jetty.project-6bfc19be1babd9e62338ab538dac0ff9684f51e0.tar.gz org.eclipse.jetty.project-6bfc19be1babd9e62338ab538dac0ff9684f51e0.tar.xz org.eclipse.jetty.project-6bfc19be1babd9e62338ab538dac0ff9684f51e0.zip |
jetty-9 optimisation to dispatch before parsing so that handling is done in same thread
Diffstat (limited to 'jetty-server/src/main/java')
-rw-r--r-- | jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java index a30e4b95d1..28c5788749 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java @@ -66,24 +66,6 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http private BlockingCallback _readBlocker = new BlockingCallback(); private BlockingCallback _writeBlocker = new BlockingCallback(); - // TODO get rid of this - private final Runnable _channelRunner = new Runnable() - { - @Override - public void run() - { - try - { - setCurrentConnection(HttpConnection.this); - _channel.run(); - } - finally - { - setCurrentConnection(null); - } - - } - }; public static HttpConnection getCurrentConnection() { @@ -102,10 +84,9 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http public HttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint) { - // Tell AbstractConnector executeOnFillable==false because we are guaranteeing that onfillable - // will never block nor take an excessive amount of CPU. ie it is OK for the selector thread to - // be used. In this case the thread that calls onfillable will be asked to do some IO and parsing. - super(endPoint, connector.getExecutor(),false); + // Tell AbstractConnector executeOnFillable==true because we want the same thread that + // does the HTTP parsing to handle the request so its cache is hot + super(endPoint, connector.getExecutor(),true); _config = config; _connector = connector; @@ -280,7 +261,15 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http // The parser returned true, which indicates the channel is ready to handle a request. // Call the channel and this will either handle the request/response to completion OR, // if the request suspends, the request/response will be incomplete so the outer loop will exit. - getExecutor().execute(_channelRunner); + try + { + setCurrentConnection(HttpConnection.this); + _channel.run(); + } + finally + { + setCurrentConnection(null); + } return; } } |