costin      02/04/17 17:14:34

  Modified:    jk/java/org/apache/jk/apr AprImpl.java
  Log:
  The quick hack I mentioned in the previous commit.
  
  Now both 3.3 and 4.1 ( and I suppose 4.0 didn't changed since yesterday ) are
  working with all 3 channels.
  
  ( httpd -X for jni channel please - shm is not yet ready :-)
  
  That doesn't mean everything is fine - requests are forwarded but the
  response is 'no context' in 4.1 ( even if the standalone is working fine ).
  Still investigating.
  
  Revision  Changes    Path
  1.9       +70 -0     jakarta-tomcat-connectors/jk/java/org/apache/jk/apr/AprImpl.java
  
  Index: AprImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/apr/AprImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AprImpl.java      17 Apr 2002 22:43:58 -0000      1.8
  +++ AprImpl.java      18 Apr 2002 00:14:34 -0000      1.9
  @@ -1,6 +1,7 @@
   package org.apache.jk.apr;
   
   import java.io.*;
  +import java.lang.reflect.*;
   import java.util.*;
   import org.apache.jk.core.*;
   
  @@ -206,6 +207,75 @@
           }
       }
   
  +    // Hack for Catalina who hungs the calling thread.
  +    public static void main( String args[] ) {
  +        System.err.println("Main");
  +        try {
  +            // Find the class
  +            Class c=null;
  +            int i=0;
  +
  +            for( i=0; i<args.length; i++ ) {
  +                String classN=args[i];
  +                if( "-".equals( classN ) ) {
  +                    // end of options.
  +                    break;
  +                }
  +                if( c!=null ) continue;
  +                try {
  +                    System.err.println("Try " + classN);
  +                    c=Class.forName( classN );
  +                } catch( ClassNotFoundException ex  ) {
  +                    continue;
  +                }
  +            }
  +
  +            i++;
  +            if( c==null ) {
  +                System.err.println("No class found ");
  +                return;
  +            }
  +            
  +            if( args.length >= i ) {
  +                String newArgs[]=new String[ args.length - i  ];
  +                System.out.println("Replacing args: " + i + " " + args.length);
  +                for( int j=0; j<newArgs.length; j++ ) {
  +                    newArgs[j]=args[i+j];
  +                    System.out.println("ARG: " + newArgs[j]);
  +                }
  +                args=newArgs;
  +            } else {
  +                System.out.println("No extra args: " + i + " " + args.length);
  +                args=new String[0];
  +            }
  +                
  +                System.err.println("Starting");
  +                Thread startThread=new Thread( new TomcatStartThread(c, args));
  +                startThread.start();
  +        } catch (Throwable t ) {
  +            t.printStackTrace(System.err);
  +        }
  +    }
  +
  +    static class TomcatStartThread implements Runnable {
  +        Class c;
  +        String args[];
  +        TomcatStartThread( Class c, String args[] ) {
  +            this.c=c;
  +            this.args=args;
  +        }
  +        
  +        public void run() {
  +            try {
  +                Class argClass=args.getClass();
  +                Method m=c.getMethod( "main", new Class[] {argClass} );
  +                m.invoke( c, new Object[] { args } );
  +            } catch( Throwable t ) {
  +                t.printStackTrace(System.err);
  +            }
  +        }
  +    }
  +    
       private static org.apache.commons.logging.Log log=
           org.apache.commons.logging.LogFactory.getLog( AprImpl.class );
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to