diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java index 106e0072582..6db2f7f4746 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java @@ -78,9 +78,14 @@ public class HttpChannel implements HttpParser.RequestHandler, Runnable return __currentChannel.get(); } - protected static void setCurrentHttpChannel(HttpChannel channel) + protected static HttpChannel setCurrentHttpChannel(HttpChannel channel) { - __currentChannel.set(channel); + HttpChannel last=__currentChannel.get(); + if (channel==null) + __currentChannel.remove(); + else + __currentChannel.set(channel); + return last; } private final AtomicBoolean _committed = new AtomicBoolean(); @@ -246,7 +251,7 @@ public class HttpChannel implements HttpParser.RequestHandler, Runnable { LOG.debug("{} handle enter", this); - setCurrentHttpChannel(this); + final HttpChannellast = setCurrentHttpChannel(this); String threadName = null; if (LOG.isDebugEnabled()) @@ -255,125 +260,131 @@ public class HttpChannel implements HttpParser.RequestHandler, Runnable 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. Unhandle will return false only if an async dispatch has - // already happened when unhandle is called. HttpChannelState.Action action = _state.handling(); - loop: while (action.ordinal()