Skip to Content.
Sympa Menu

notify-dpml - r1258 - trunk/main/station/console/src/main/net/dpml/station/console

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1258 - trunk/main/station/console/src/main/net/dpml/station/console
  • Date: Thu, 23 Mar 2006 22:17:47 +0100

Author: mcconnell
Date: 2006-03-23 22:17:41 +0100 (Thu, 23 Mar 2006)
New Revision: 1258

Modified:

trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
Log:
improve error handling in station console

Modified:
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
===================================================================
---
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
2006-03-23 20:58:27 UTC (rev 1257)
+++
trunk/main/station/console/src/main/net/dpml/station/console/StationPlugin.java
2006-03-23 21:17:41 UTC (rev 1258)
@@ -145,8 +145,7 @@
}
else if( line.hasOption( SHUTDOWN_COMMAND ) )
{
- Manager manager = getManager( line );
- processShutdown( manager );
+ processShutdown( line );
}
else if( line.hasOption( ADD_COMMAND ) )
{
@@ -493,8 +492,7 @@
getLogger().debug( info );

Process process = Runtime.getRuntime().exec( args, null );
- getLogger().info( "startup in process" );
-
+ getLogger().info( "waiting for server" );
OutputStreamReader output = new OutputStreamReader( getLogger(),
process.getInputStream() );
ErrorStreamReader err = new ErrorStreamReader( getLogger(),
process.getErrorStream() );
output.setDaemon( true );
@@ -502,32 +500,49 @@
output.start();
err.start();

- //while( null == getStation( port ) )
- //{
- // try
- // {
- // Thread.currentThread().sleep( 600 );
- // }
- // catch( Exception e )
- // {
- // }
- //}
+ int n = 0;
+ while( ( null == getStation( port ) && n < 20 ) )
+ {
+ try
+ {
+ Thread.currentThread().sleep( 600 );
+ }
+ catch( Exception e )
+ {
+ }
+ n++;
+ }

- getLogger().info( "station started" );
+ if( null == getStation( port ) )
+ {
+ getLogger().info( "server failed to start" );
+ }
+ else
+ {
+ getLogger().info( "station started" );
+ }
}

- private void processShutdown( Manager manager ) throws Exception
+ private void processShutdown( CommandLine line ) throws Exception
{
- getLogger().info( "initiating station shutdown" );
try
{
- manager.shutdown();
+ Manager manager = getManager( line );
+ getLogger().info( "initiating station shutdown" );
+ try
+ {
+ manager.shutdown();
+ }
+ catch( Exception e )
+ {
+ getLogger().warn( e.getClass().getName() );
+ }
+ getLogger().info( "station shutdown complete" );
}
catch( Exception e )
{
- getLogger().warn( e.getClass().getName() );
- }
- getLogger().info( "station shutdown complete" );
+ getLogger().info( "station is not running" );
+ }
}

/**




  • r1258 - trunk/main/station/console/src/main/net/dpml/station/console, mcconnell at BerliOS, 03/23/2006

Archive powered by MHonArc 2.6.24.

Top of Page