+
+ private class RestartVM extends Thread
+ {
+ private ConnectedClient cc ;
+
+ protected RestartVM( ConnectedClient _cc )
+ {
+ cc = _cc ;
+ }
+
+ public void run()
+ {
+ boolean error = false ;
+ if( cc != null )
+ {
+ try {
+ if( cc.getStub().restartVMAfterCrash() != 0 )
+ {
+ System.err.println( "Problem while restarting VM on " + cc.getName() + "!" ) ;
+ error = true ;
+ }
+ } catch( RemoteException e ) {
+ e.printStackTrace() ;
+ error = true ;
+ yield() ;
+ }
+ } else {
+ System.err.println( "The client to restart is null!" ) ;
+ }
+
+ if( error )
+ {
+ cc.setFail( true ) ;
+
+ try {
+ System.out.print( "Trying to stop the client ... " ) ;
+ cc.getStub().stop() ;
+ System.out.println( "successful client stop." );
+ } catch( RemoteException e ) {
+ System.out.println( "unsuccessful client stop!" ) ;
+ e.printStackTrace() ;
+ }
+ }
+ }
+ }
+