tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/startup EmbededTomcat.java Main.java
Date Thu, 12 Feb 2004 08:24:03 GMT
billbarker    2004/02/12 00:24:03

  Modified:    src/share/org/apache/tomcat/startup EmbededTomcat.java
                        Main.java
  Log:
  Adding a 'startb' option to start and block.  Primarily for use with procrun.
  
  Revision  Changes    Path
  1.67      +32 -0     jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java
  
  Index: EmbededTomcat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- EmbededTomcat.java	22 Sep 2003 09:18:58 -0000	1.66
  +++ EmbededTomcat.java	12 Feb 2004 08:24:03 -0000	1.67
  @@ -154,6 +154,7 @@
       
       boolean serverXml=true;
       boolean help;
  +    boolean blocking=false;
   
       // prevent tomcat from starting.
       boolean nostart=false;
  @@ -182,6 +183,12 @@
   	debug( "Debugging enabled ");
       }
   
  +    /**
  +     * set if we need to block.
  +     */
  +    public void setStartb(boolean b) {
  +	blocking = b;
  +    }
   
       boolean noClassLoaders=false;
       
  @@ -611,6 +618,25 @@
   	contextM.start();
   	long time4=System.currentTimeMillis();
   	debug("Startup time " + ( time4-time3 ));
  +	if(blocking) {
  +	    await();
  +	}
  +    }
  +
  +    /**
  +     * Wait for a shutdown.
  +     */
  +    void await() {
  +	while(blocking) {
  +	    synchronized(this) {
  +		try{
  +		    wait();
  +		    blocking = false;
  +		}catch(Exception ex) {
  +		    contextM.log("Error in await",ex);
  +		}
  +	    }
  +	}
       }
   
       /** Shutdown contextM - <em>may</em> exit the VM.
  @@ -621,12 +647,18 @@
        */
       public void shutdown() throws TomcatException {
   	contextM.shutdown();
  +	if(blocking) {
  +	    notify();
  +	}
       }
   
       /** Stop contextM - will not exit the VM.
        */
       public void stop() throws TomcatException {
   	contextM.stop();
  +	if(blocking) {
  +	    notify();
  +	}
       }
   
       // -------------------- Helpers and shortcuts --------------------
  
  
  
  1.44      +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Main.java	22 Sep 2003 09:18:58 -0000	1.43
  +++ Main.java	12 Feb 2004 08:24:03 -0000	1.44
  @@ -231,6 +231,7 @@
   	tasks.put("stop", "org.apache.tomcat.startup.StopTomcat");
   	tasks.put("enableAdmin", "org.apache.tomcat.startup.EnableAdmin");
   	tasks.put("start", "org.apache.tomcat.startup.EmbededTomcat");
  +        tasks.put("startb", "org.apache.tomcat.startup.EmbededTomcat"); 
   	tasks.put("run", "org.apache.tomcat.startup.EmbededTomcat");
   	tasks.put("jspc", "org.apache.tomcat.startup.Jspc");
   	tasks.put("estart", "org.apache.tomcat.startup.EmbededTomcat");
  
  
  

---------------------------------------------------------------------
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