You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2001/12/15 23:48:11 UTC

cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/launcher DaemonLauncher.java

donaldp     01/12/15 14:48:11

  Modified:    src/java/org/apache/avalon/phoenix/launcher
                        DaemonLauncher.java
  Log:
  Add some more debugging when WrapperManager.isDebugEnabled() is true.
  
  Also converted to not start up another thread to run Phoenix. Instead phoenix is just started in same thread.
  
  Revision  Changes    Path
  1.4       +32 -21    jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/launcher/DaemonLauncher.java
  
  Index: DaemonLauncher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/launcher/DaemonLauncher.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DaemonLauncher.java	2001/12/11 10:13:35	1.3
  +++ DaemonLauncher.java	2001/12/15 22:48:11	1.4
  @@ -20,36 +20,26 @@
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    */
   public class DaemonLauncher
  -    implements WrapperListener, Runnable, ActionListener
  +    implements WrapperListener, ActionListener
   {
  -    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()
  -    {
           final Hashtable data = new Hashtable();
           data.put( ActionListener.class.getName(), this );
   
  -        try { Main.startup( m_args, data ); }
  +        try { Main.startup( args, data ); }
           catch( final Exception e )
           {
               e.printStackTrace();
           }
  +
  +        // We are almost up now, so reset the wait time
  +        WrapperManager.signalStarting( 2000 );
  +
  +        return null;
       }
   
       public int stop( final int exitCode )
  @@ -62,12 +52,25 @@
       {
           if( WrapperManager.isControlledByNativeWrapper() )
           {
  +            if ( WrapperManager.isDebugEnabled() )
  +            {
  +                System.out.println( "DaemonLauncher: controlEvent(" + event + ") - Ignored." );
  +            }
  +            
               // This application ignores all incoming control events.
               //  It relies on the wrapper code to handle them.
           }
           else
           {
  +            if ( WrapperManager.isDebugEnabled() )
  +            {
  +                System.out.println( "DaemonLauncher: controlEvent(" + event + ") - Stopping." );
  +            }
  +            
  +            // Not being run under a wrapper, so this isn't an NT service and should always exit.
  +            //  Handle the event here.
               WrapperManager.stop( 0 );
  +            // Will not get here.
           }
       }
   
  @@ -82,12 +85,20 @@
           final String command = action.getActionCommand();
           if( command.equals( "restart" ) )
           {
  -            System.out.println( "Pre-restart()" );
  -            System.out.flush();
  +            if ( WrapperManager.isDebugEnabled() )
  +            {
  +                System.out.println( "DaemonLauncher: restart requested." );
  +                System.out.flush();
  +            }
  +
               WrapperManager.restart();
  -            System.out.println( "Post-restart()" );
  -            System.out.flush();
   
  +            if ( WrapperManager.isDebugEnabled() )
  +            {
  +                //Should never get here???
  +                System.out.println( "DaemonLauncher: restart completed." );
  +                System.out.flush();
  +            }
           }
           else
           {
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>