avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-phoenix build.xml
Date Sat, 08 Dec 2001 04:39:02 GMT
donaldp     01/12/07 20:39:02

  Modified:    .        build.xml
  Added:       src/java/org/apache/avalon/phoenix/launcher
                        DaemonLauncher.java
  Log:
  Compile an alternate launcher that is based on the Wrapper project at http://wrapper.sourceforge.net/
  
  Does the same as the normal launcher but through an interface that is more easy to integrate
into existing OS specific behaviour.
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/launcher/DaemonLauncher.java
  
  Index: DaemonLauncher.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.phoenix.launcher;
  
  import com.silveregg.wrapper.WrapperListener;
  import com.silveregg.wrapper.WrapperManager;
  
  /**
   * A frontend for Phoenix that starts it as a native service
   * using the Java Service Wrapper at http://wrapper.sourceforge.net
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   */
  public class DaemonLauncher
      implements WrapperListener, Runnable
  {
      private String[] m_args;
  
      public Integer start( final String[] args )
      {
          // This startup could take a while, so tell the wrapper to be patient.
          WrapperManager.signalStarting( 45000 );
  
          m_args = args;
  
          final Thread thread = new Thread( this );
          thread.start();
  
          // We are almost up now, so reset the wait time
          WrapperManager.signalStarting( 2000 );
  
          return null;
      }
      
      public void run()
      {
          try { Main.main( m_args ); }
          catch( final Exception e )
          {
              e.printStackTrace();
          }
      }
  
      public int stop( final int exitCode )
      {
          Main.shutdown();
          return exitCode;
      }
  
      public void controlEvent( final int event )
      {
          if( WrapperManager.isControlledByNativeWrapper() )
          {
              // This application ignores all incoming control events.
              //  It relies on the wrapper code to handle them.
          }
          else
          {
              WrapperManager.stop( 0 );
          }
      }
  
      public static void main( final String[] args )
      {
          WrapperManager.start( new DaemonLauncher(), args );
      }
  }
  
  
  
  1.85      +5 -0      jakarta-avalon-phoenix/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/build.xml,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- build.xml	2001/12/08 04:34:04	1.84
  +++ build.xml	2001/12/08 04:39:02	1.85
  @@ -131,6 +131,9 @@
       <available property="jmx.present" classname="javax.management.MBeanException">
         <classpath refid="project.class.path"/>
       </available>
  +    <available property="wrapper.present" classname="com.silveregg.wrapper.WrapperManager">
  +      <classpath refid="project.class.path"/>
  +    </available>
     </target>
   
     <!-- Setup the filters -->
  @@ -240,6 +243,8 @@
         <exclude name="**/*MBean.java" unless="jmx.present"/>
         <exclude name="org/apache/avalon/phoenix/components/manager/DefaultManager.java"

                  unless="jmx.present"/>
  +      <exclude name="org/apache/avalon/phoenix/launcher/DaemonLauncher.java" 
  +               unless="wrapper.present"/>
       </javac>
   
       <copy todir="${build.classes}">
  
  
  

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


Mime
View raw message