+
+ // Changing on save neighbors
+ for( int i = 0 ; i < machine.getSaveNeighbors().size() ; i++ )
+ {
+ try {
+ machine.getSaveNeighbors().get( i ).getStub().changeSaveName( save_new, save_name, machine.getComputationId() ) ;
+ } catch( RemoteException e ) {
+ System.err.println( "Unable to change save name on " + machine.getSaveNeighbors().get( i ).getName() + "!" ) ;
+ e.printStackTrace() ;
+ }
+ }
+
+ // Informing the server
+ int ret = 1 ;
+ try {
+ ret = LocalHost.Instance().getServerStub().changeSaveName( LocalHost.Instance().getIP(), save_name ) ;
+ } catch( RemoteException e ) {
+ System.err.println( "Unable to inform the server about the new save name!" ) ;
+ e.printStackTrace() ;
+ }
+
+ if( ret == 0 )
+ {
+ System.out.println( "Successfully informing the server about the new save name." ) ;
+ } else {
+ System.err.println( "Problem on the server while informing it about the new save name!" ) ;
+ }
+
+ // Ok here
+ lastSaveOk = true ;
+ }
+
+
+ public void changeSaveName( String _n1, String _n2, int _id )
+ {
+ if( _n1 != null && _n1.length() > 0 )
+ {
+ System.out.println( "Changing save name for processus " + _id + " ... " ) ;
+
+ String[] command = new String[]{ "/bin/mv",
+ working_directory + "/" + _n1,
+ working_directory + "/" + _n2 } ;
+
+ try {
+ Process p = Runtime.getRuntime().exec( command ) ;
+ p.waitFor() ;
+
+ if( p.exitValue() == 0 )
+ {
+ System.out.println( "Change save name OK" ) ;
+ } else {
+ System.err.println( "Change save name NOK!" ) ;
+ System.err.println( "Error: " ) ;
+ printProcessError( p ) ;
+ }
+ } catch( IOException e ) {
+ System.err.println( "Error during save renaming:" ) ;
+ e.printStackTrace() ;
+ } catch( InterruptedException e ) {
+ e.printStackTrace() ;
+ }
+ }