From 273f48dec2ebb0d70137544ec4fe88956f09b18e Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 28 May 2009 09:49:00 +0000 Subject: [PATCH] handled stop while requests are suspended git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@318 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../org/eclipse/jetty/server/HttpConnection.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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 fc7a01cb397..81e2bbfdeb0 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 @@ -500,7 +500,6 @@ public class HttpConnection implements Connection /* ------------------------------------------------------------ */ protected void handleRequest() throws IOException { - boolean handling=_server.isRunning() && _request._async.handling(); boolean error = false; String threadName=null; @@ -512,6 +511,7 @@ public class HttpConnection implements Connection Thread.currentThread().setName(threadName+" - "+_uri); } + // Loop here to handle async request redispatches. // The loop is controlled by the call to async.unhandle in the // finally block below. If call is from a non-blocking connector, @@ -519,6 +519,9 @@ public class HttpConnection implements Connection // already happened when unhandle is called. For a blocking connector, // the wait for the asynchronous dispatch or timeout actually happens // within the call to unhandle(). + + final Server server=_server; + boolean handling=_request._async.handling() && server!=null && server.isRunning(); while (handling) { _request.setHandled(false); @@ -536,14 +539,13 @@ public class HttpConnection implements Connection { _request.setDispatcherType(DispatcherType.REQUEST); _connector.customize(_endp, _request); - _server.handle(this); + server.handle(this); } else { _request.setDispatcherType(DispatcherType.ASYNC); - _server.handleAsync(this); + server.handleAsync(this); } - } catch (EofException e) { @@ -573,7 +575,7 @@ public class HttpConnection implements Connection } finally { - handling = !_request._async.unhandle() && _server != null; + handling = !_request._async.unhandle() && server.isRunning() && _server!=null; } } }