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-4.0/catalina/src/share/org/apache/catalina/core StandardPipeline.java
Date Mon, 01 Apr 2002 04:19:55 GMT
remm        02/03/31 20:19:55

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardPipeline.java
  Log:
  - Use a note in the request instead of a ThreadLocal to keep track of the
    pipeline stage.
    Note: This could cause problems with a valve that would wrap the request,
    and not delegate the getNote method to the wrapped request.
  
  Revision  Changes    Path
  1.5       +25 -17    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardPipeline.java
  
  Index: StandardPipeline.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardPipeline.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardPipeline.java	3 Jan 2002 01:52:14 -0000	1.4
  +++ StandardPipeline.java	1 Apr 2002 04:19:54 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardPipeline.java,v
1.4 2002/01/03 01:52:14 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/01/03 01:52:14 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardPipeline.java,v
1.5 2002/04/01 04:19:54 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/04/01 04:19:54 $
    *
    * ====================================================================
    *
  @@ -100,6 +100,12 @@
       implements Pipeline, Contained, Lifecycle, ValveContext {
   
   
  +    // -------------------------------------------------------------- Constants
  +
  +
  +    protected static final String STATE = "pipelineState";
  +
  +
       // ----------------------------------------------------------- Constructors
   
   
  @@ -174,16 +180,6 @@
   
   
       /**
  -     * The per-thread execution state for processing through this pipeline.
  -     * The actual value is a java.lang.Integer object containing the subscript
  -     * into the <code>valves</code> array, or a subscript equal to
  -     * <code>valves.length</code> if the basic Valve is currently being
  -     * processed.
  -     */
  -    protected ThreadLocal state = new ThreadLocal();
  -
  -
  -    /**
        * The set of Valves (not including the Basic one, if any) associated with
        * this Pipeline.
        */
  @@ -477,7 +473,7 @@
           throws IOException, ServletException {
   
           // Initialize the per-thread state for this thread
  -        state.set(new Integer(0));
  +        request.setNote(STATE, new PipelineState());
   
           // Invoke the first Valve in this pipeline for this request
           invokeNext(request, response);
  @@ -566,9 +562,9 @@
           throws IOException, ServletException {
   
           // Identify the current subscript for the current request thread
  -        Integer current = (Integer) state.get();
  -        int subscript = current.intValue();
  -        state.set(new Integer(subscript + 1));
  +        PipelineState pipelineState = (PipelineState) request.getNote(STATE);
  +        int subscript = pipelineState.stage;
  +        pipelineState.stage = pipelineState.stage + 1;
   
           // Invoke the requested Valve for the current request thread
           if (subscript < valves.length) {
  @@ -625,6 +621,18 @@
                                  "]: " + message);
               throwable.printStackTrace(System.out);
           }
  +
  +    }
  +
  +
  +    // ---------------------------------------------- PipelineState Inner Class
  +
  +
  +    protected class PipelineState {
  +
  +
  +        int stage = 0;
  +
   
       }
   
  
  
  

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


Mime
View raw message