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/src/java/org/apache/avalon/phoenix/launcher Main.java
Date Sat, 08 Dec 2001 04:27:10 GMT
donaldp     01/12/07 20:27:10

  Modified:    src/java/org/apache/avalon/phoenix/launcher Main.java
  Log:
  Add a protected Shutdown() method that uses reflection to call shutdown on the frontend
loaded.
  
  Revision  Changes    Path
  1.5       +26 -3     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/launcher/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/launcher/Main.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Main.java	2001/12/02 03:48:59	1.4
  +++ Main.java	2001/12/08 04:27:10	1.5
  @@ -29,6 +29,8 @@
       private final static String MAIN_JAR = "phoenix-engine.jar";
       private final static String LOADER_JAR = "phoenix-loader.jar";
   
  +    private static Object c_frontend;
  +
       public final static void main( final String args[] )
           throws Exception
       {
  @@ -48,14 +50,35 @@
               //Create main launcher
               final Class clazz = classLoader.loadClass( MAIN_CLASS );
               final Method method = clazz.getMethod( "main", new Class[]{ args.getClass()
} );
  -            final Object instance = clazz.newInstance();
  -
  +            c_frontend = clazz.newInstance();
  +            
               //kick the tires and light the fires....
  -            method.invoke( instance, new Object[]{ args } );
  +            method.invoke( c_frontend, new Object[]{ args } );
  +        }
  +        catch( final Exception e )
  +        {
  +            e.printStackTrace();
  +        }
  +    }
  +
  +    protected final static void shutdown()
  +    {
  +        if( null == c_frontend ) return;
  +        try
  +        {
  +            final Class clazz = c_frontend.getClass();
  +            final Method method = clazz.getMethod( "shutdown", new Class[ 0 ] );
  +
  +            //Lets put this sucker to sleep
  +            method.invoke( c_frontend, new Object[ 0 ] );
           }
           catch( final Exception e )
           {
               e.printStackTrace();
  +        }
  +        finally
  +        {
  +            c_frontend = null;
           }
       }
   
  
  
  

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