You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/02/08 00:18:45 UTC

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

remm        2003/02/07 15:18:44

  Modified:    jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  - There is a problem with therad with attributes when Tomcat is used in process
    (as the threads used aren't created by Tomcat, it causes class casts).
  
  Revision  Changes    Path
  1.24      +15 -6     jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- HandlerRequest.java	28 Jan 2003 05:42:24 -0000	1.23
  +++ HandlerRequest.java	7 Feb 2003 23:18:44 -0000	1.24
  @@ -330,7 +330,10 @@
           throws IOException
       {
           int type=msg.getByte();
  -        ThreadWithAttributes twa=(ThreadWithAttributes)Thread.currentThread();
  +        ThreadWithAttributes twa = null;
  +        if (Thread.currentThread() instanceof ThreadWithAttributes) {
  +            twa = (ThreadWithAttributes) Thread.currentThread();
  +        }
           Object control=ep.getControl();
   
           MessageBytes tmpMB=(MessageBytes)ep.getNote( tmpBufNote );
  @@ -344,11 +347,15 @@
           switch( type ) {
           case JK_AJP13_FORWARD_REQUEST:
               try {
  -                twa.setCurrentStage(control, "JkDecode");
  +                if (twa != null) {
  +                    twa.setCurrentStage(control, "JkDecode");
  +                }
                   decodeRequest( msg, ep, tmpMB );
  -                twa.setCurrentStage(control, "JkService");
  -                twa.setParam(control,
  -                        ((Request)ep.getRequest()).unparsedURI().toString());
  +                if (twa != null) {
  +                    twa.setCurrentStage(control, "JkService");
  +                    twa.setParam(control,
  +                                 ((Request)ep.getRequest()).unparsedURI());
  +                }
               } catch( Exception ex ) {
                   log.error( "Error decoding request ", ex );
                   msg.dump( "Incomming message");
  @@ -366,7 +373,9 @@
                     next.getClass().getName());
   
               int err= next.invoke( msg, ep );
  -            twa.setCurrentStage(control, "JkDone");
  +            if (twa != null) {
  +                twa.setCurrentStage(control, "JkDone");
  +            }
   
               if( log.isDebugEnabled() )
                   log.debug( "Invoke returned " + err );
  
  
  

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