clients.get( i ).getStub().emergencyStop() ;
clients.get( i ).getStub().stop() ;
} catch (RemoteException e) {
- e.printStackTrace();
+ System.err.println( "Unable to send stop signal to " + clients.get( i ).getName() ) ;
+ e.printStackTrace() ;
}
}
} catch( RemoteException e ) {
System.err.println( "Unable to indicate to client to retrieve last save!" ) ;
e.printStackTrace() ;
+ yield() ;
}
if( res == 0 )
} catch( RemoteException e ) {
System.err.println( "Unable to set the new VM IP on the replacing client!" ) ;
e.printStackTrace() ;
+ yield() ;
}
if( ok_new && ok_old )
// break ;
// }
// }
- synchronized( counter ){
- counter.inc() ;}
+ synchronized( counter )
+ {
+ counter.inc() ;
+ }
-
new Server.FaultManager( cl ).start() ;
nb_disconnections_computing++ ;
} else {
} catch( RemoteException e ) {
System.err.println( "Unable to invoke emergency stop signal on " + clients.get( i ).getName() ) ;
e.printStackTrace() ;
+ yield() ;
}
}
}
counter.wait() ;
} catch( InterruptedException e ) {
e.printStackTrace() ;
+ yield() ;
}
}
}
for( int i = 0 ; i < applications.get( ind ).getComputingClients().size() ; i++ )
{
- final ServicesClient sc = applications.get( ind ).getComputingClients().get( i ).getClient().getStub() ;
-
applications.get( ind ).getComputingClients().get( i ).setRestartOk( false ) ;
+ final ServicesClient sc = applications.get( ind ).getComputingClients().get( i ).getClient().getStub() ;
+
new Thread( new Runnable() {
@Override
sc.restartVMAfterCrash() ;
} catch( RemoteException e ) {
e.printStackTrace() ;
+ yield() ;
}
}
} ).start() ;
Thread.sleep( 2000 ) ;
} catch( InterruptedException e ) {
e.printStackTrace() ;
+ yield() ;
}
}
}
try {
computingClients.get( i ).getClient().getStub().saveOk() ;
} catch (RemoteException e) {
- e.printStackTrace();
+ System.err.println( "Unable to invoke the saveOk method on " + computingClients.get( i ).getClient().getName() ) ;
+ e.printStackTrace() ;
}
computingClients.get( i ).setSaveStatus( false ) ;
}
if( computingClients.get( i ).getClient().getIP().equalsIgnoreCase( _ip ) )
{
computingClients.get( i ).setLastSave( _saveName ) ;
- System.out.println( "Save name successfully changed on " + _ip ) ;
+ System.out.println( "Save name successfully changed on " + computingClients.get( i ).getClient().getName() ) ;
return 0 ;
}
}
+
+ System.err.println( "Unable to found computing client with IP " + _ip + "!" ) ;
+ return 1 ;
}
+ System.err.println( "Unable to change save name. IP or save name empty ! (IP: " + _ip + " ; save name: " + _saveName +")" ) ;
+
return 1 ;
}
+
@Override
public ArrayList<ServicesClient> startApplication( int _nb )
{
try {
startingClients.wait() ;
- } catch (InterruptedException e) {
- e.printStackTrace();
+ } catch( InterruptedException e ) {
+ e.printStackTrace() ;
}
}
}
final int indice = i ;
- new Thread( new Runnable(){
-
+ new Thread( new Runnable()
+ {
@Override
public void run()
{
try {
res = clients.get( indice ).getStub().startVM( 0 ) ;
} catch( RemoteException e ) {
- e.printStackTrace();
+ e.printStackTrace() ;
}
if( res == 0 )
if( applications.size() > 0 && _ip != null && _ip.length() > 0 )
{
System.out.println( "Client " + _ip + " has finished to restart ("+applications.get( ind ).getComputingClients().size()+") ... " ) ;
- if( (System.currentTimeMillis() - applications.get( ind ).getLastSaveDate()) > save_interleave )
+// if( (System.currentTimeMillis() - applications.get( ind ).getLastSaveDate()) > save_interleave )
{
// Has it already finished?
for( int i = 0 ; i < applications.get( ind ).getComputingClients().size() ; i++ )
}
}
- // Is every body ok?
+ // Is everybody ok?
boolean ok = false ;
for( int i = 0 ; i < applications.get( ind ).getComputingClients().size() ; i++ )
{