From: remm Date: Sat, 10 Feb 2007 02:30:04 +0000 (+0000) Subject: - Set of minor optimizations. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=71bf5eac28ce858ba11f0d5987b15c1af2b3846c;p=tomcat7.0 - Set of minor optimizations. - getServletContext is used often. - Submitted by Arvind Srinivasan. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@505618 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/StandardWrapperFacade.java b/java/org/apache/catalina/core/StandardWrapperFacade.java index 88ac27ade..c42e1d973 100644 --- a/java/org/apache/catalina/core/StandardWrapperFacade.java +++ b/java/org/apache/catalina/core/StandardWrapperFacade.java @@ -59,6 +59,12 @@ public final class StandardWrapperFacade private ServletConfig config = null; + /** + * Wrapped context (facade). + */ + private ServletContext context = null; + + // -------------------------------------------------- ServletConfig Methods @@ -68,11 +74,12 @@ public final class StandardWrapperFacade public ServletContext getServletContext() { - ServletContext theContext = config.getServletContext(); - if ((theContext != null) && - (theContext instanceof ApplicationContext)) - theContext = ((ApplicationContext) theContext).getFacade(); - return (theContext); + if (context == null) { + context = config.getServletContext(); + if ((context != null) && (context instanceof ApplicationContext)) + context = ((ApplicationContext) context).getFacade(); + } + return (context); }