optimized stack of scoped handlers

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@389 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-06-12 23:36:27 +00:00
parent fbfc459631
commit bc1bd1713a
3 changed files with 34 additions and 3 deletions

View File

@ -856,7 +856,16 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
baseRequest.setPathInfo(pathInfo);
}
nextScope(target,baseRequest,request,response);
// start manual inline of nextScope(target,baseRequest,request,response);
if (false)
nextScope(target,baseRequest,request,response);
else if (_nextScope!=null)
_nextScope.doScope(target,baseRequest,request, response);
else if (_outerScope!=null)
_outerScope.doHandle(target,baseRequest,request, response);
else
doHandle(target,baseRequest,request, response);
// end manual inline (pathentic attempt to reduce stack depth)
}
finally
{
@ -910,7 +919,14 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
if (DispatcherType.REQUEST.equals(dispatch) && isProtectedTarget(target))
throw new HttpException(HttpServletResponse.SC_NOT_FOUND);
nextHandle(target,baseRequest,request,response);
// start manual inline of nextHandle(target,baseRequest,request,response);
if (false)
nextHandle(target,baseRequest,request,response);
else if (_nextScope!=null && _nextScope==_handler)
_nextScope.doHandle(target,baseRequest,request, response);
else if (_handler!=null)
_handler.handle(target,baseRequest, request, response);
// end manual inline
}
catch(HttpException e)
{

View File

@ -132,6 +132,9 @@ public abstract class ScopedHandler extends HandlerWrapper
public final void nextScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
// this method has been manually inlined in several locations, but
// is called protected by an in(false), so your IDE can find those
// locations if this code is changed.
if (_nextScope!=null)
_nextScope.doScope(target,baseRequest,request, response);
else if (_outerScope!=null)
@ -153,6 +156,9 @@ public abstract class ScopedHandler extends HandlerWrapper
*/
public final void nextHandle(String target, final Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
// this method has been manually inlined in several locations, but
// is called protected by an in(false), so your IDE can find those
// locations if this code is changed.
if (_nextScope!=null && _nextScope==_handler)
_nextScope.doHandle(target,baseRequest,request, response);
else if (_handler!=null)

View File

@ -361,7 +361,16 @@ public class ServletHandler extends ScopedHandler
old_scope=baseRequest.getUserIdentityScope();
baseRequest.setUserIdentityScope(servlet_holder);
nextScope(target,baseRequest,request, response);
// start manual inline of nextScope(target,baseRequest,request,response);
if (false)
nextScope(target,baseRequest,request,response);
else if (_nextScope!=null)
_nextScope.doScope(target,baseRequest,request, response);
else if (_outerScope!=null)
_outerScope.doHandle(target,baseRequest,request, response);
else
doHandle(target,baseRequest,request, response);
// end manual inline (pathentic attempt to reduce stack depth)
}
}
finally