You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/08/11 05:21:16 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/server Ajp12Interceptor.java

larryi      01/08/10 20:21:16

  Modified:    src/share/org/apache/tomcat/modules/server
                        Ajp12Interceptor.java
  Log:
  Add ajpidFile parameter so "stop" file may be specified
  
  Revision  Changes    Path
  1.15      +14 -2     jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp12Interceptor.java
  
  Index: Ajp12Interceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp12Interceptor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Ajp12Interceptor.java	2001/05/18 19:20:14	1.14
  +++ Ajp12Interceptor.java	2001/08/11 03:21:16	1.15
  @@ -71,6 +71,7 @@
   import org.apache.tomcat.util.net.*;
   import org.apache.tomcat.util.*;
   import org.apache.tomcat.util.http.*;
  +import org.apache.tomcat.util.io.FileUtil;
   
   /* 
    */
  @@ -78,6 +79,7 @@
       implements  TcpConnectionHandler{
       private boolean tomcatAuthentication=true;
       String secret;
  +    File ajpidFile=null;
       
       public Ajp12Interceptor() {
   	super();
  @@ -100,6 +102,12 @@
       public void setSecret( String s ) {
   	secret=s;
       }
  +
  +    /** Specify ajpid file used when shutting down tomcat
  +     */
  +    public void setAjpidFile( String path ) {
  +        ajpidFile=( path==null?null:new File(path));
  +    }
       
       public void engineState(ContextManager cm, int state )
   	throws TomcatException
  @@ -112,9 +120,13 @@
   	Ajp12Interceptor tcpCon=this;
   	int portInt=tcpCon.getPort();
   	InetAddress address=tcpCon.getAddress();
  +        File sf=FileUtil.getConfigFile(ajpidFile, new File(cm.getHome()),
  +                        "conf/ajp12.id");
  +        if( ajpidFile != null || debug > 0)
  +            log( "Using stop file: "+sf);
   	try {
   	    PrintWriter stopF=new PrintWriter
  -		(new FileWriter(cm.getHome() + "/conf/ajp12.id"));
  +		(new FileWriter(sf));
   	    stopF.println( portInt );
   	    if( address==null )
   		stopF.println( "" );
  @@ -126,7 +138,7 @@
   		stopF.println();
   	    stopF.close();
   	} catch( IOException ex ) {
  -	    log( "Can't create ajp12.id " + ex );
  +	    log( "Can't create stop file: "+sf, ex );
   	}
       }