tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java
Date Sat, 19 Apr 2003 08:31:05 GMT
remm        2003/04/19 01:31:04

  Modified:    catalina/src/share/org/apache/catalina/servlets
                        DefaultServlet.java
  Log:
  - Make resource info thread local (exactly one object is needed
    per processing thread).
  
  Revision  Changes    Path
  1.7       +27 -7     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultServlet.java	18 Apr 2003 17:34:44 -0000	1.6
  +++ DefaultServlet.java	19 Apr 2003 08:31:04 -0000	1.7
  @@ -194,9 +194,17 @@
   
   
       /**
  -     * GMT timezone - all HTTP dates are on GMT
  +     * Thread local resource info.
        */
  +    protected ThreadLocal localResourceInfo = new ThreadLocal();
  +
  +
       // ----------------------------------------------------- Static Initializer
  +
  +
  +    /**
  +     * GMT timezone - all HTTP dates are on GMT
  +     */
       static {
           urlEncoder = new URLEncoder();
           urlEncoder.addSafeCharacter('-');
  @@ -574,7 +582,13 @@
           // Input stream for temp. content file used to support partial PUT
           FileInputStream contentFileInStream = null;
   
  -        ResourceInfo resourceInfo = new ResourceInfo(path, resources);
  +        ResourceInfo resourceInfo = (ResourceInfo) localResourceInfo.get();
  +        if (resourceInfo == null) {
  +            resourceInfo = new ResourceInfo(path, resources);
  +            localResourceInfo.set(resourceInfo);
  +        } else {
  +            resourceInfo.set(path, resources);
  +        }
           Range range = parseContentRange(req, resp);
   
           InputStream resourceInputStream = null;
  @@ -907,7 +921,13 @@
   
           // Retrieve the Catalina context and Resources implementation
           DirContext resources = getResources();
  -        ResourceInfo resourceInfo = new ResourceInfo(path, resources);
  +        ResourceInfo resourceInfo = (ResourceInfo) localResourceInfo.get();
  +        if (resourceInfo == null) {
  +            resourceInfo = new ResourceInfo(path, resources);
  +            localResourceInfo.set(resourceInfo);
  +        } else {
  +            resourceInfo.set(path, resources);
  +        }
   
           if (!resourceInfo.exists) {
               response.sendError(HttpServletResponse.SC_NOT_FOUND, 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message