Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correction of the start application time setup.
[hpcvm.git] / src / and / hpcvm / Client.java
index 06bb4e7..e3233eb 100644 (file)
@@ -1245,7 +1245,7 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                                while( (line = br.readLine()) != null )
                                {
                                        System.err.println( line ) ;
-                                       if( line.contains( "egmentation" ) ) 
+                                       if( line.contains( "egmentation" ) || _p.exitValue() == 139 
                                        {
                                                ret = true ;
                                        }
@@ -1258,6 +1258,13 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                return ret ;
        }
        
+       
+       @Override
+       public int echo()
+       {
+               return 0 ;
+       }
+       
 
        @Override
        public int start() 
@@ -1328,12 +1335,14 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                                } catch( RemoteException e1 ) {
                                        System.err.println( "Unable to ping the server!" ) ;
                                        e1.printStackTrace() ;
+                                       yield() ;
                                }
                                
                                try {
                                        sleep( 2000 ) ;
                                } catch( InterruptedException e ) {
                                        e.printStackTrace() ;
+                                       yield() ;
                                }
                        }
                }
@@ -1361,6 +1370,7 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                                        serverSocket.close() ;                                  
                                } catch( IOException e ) {
                                        e.printStackTrace() ;
+                                       yield() ;
                                }
                        }                       
                }
@@ -1377,8 +1387,7 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                        } catch( IOException e ) {
                                System.err.println( "Unable to launch the SocketServer on port " + dialog_port + "!" ) ;
                                e.printStackTrace() ;
-                               
-                               go = false ;
+                               System.exit( 1 ) ;
                        }       
                        
                        while( go )
@@ -1391,6 +1400,7 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                                } catch( IOException e ) {
                                        System.err.println( "Problem with the accept function!" ) ;
                                        e.printStackTrace() ;
+                                       yield() ;
                                }
                        }
                }
@@ -1412,7 +1422,8 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                                reader = new BufferedReader( new InputStreamReader( socket.getInputStream() ) ) ;
                        } catch( IOException e ) {
                                System.err.println( "Unable to open a dialog socket with the VM!" ) ;
-                               e.printStackTrace();
+                               e.printStackTrace() ;
+                               yield() ;
                        }
 
                        try {
@@ -1475,7 +1486,13 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                                                saveRequest.setStatus( false ) ;
 
                                                /* Requesting the VM save */
-                                               saveVM() ;
+                                               if( saveVM() == 1 )
+                                               {
+                                                       System.err.println( "Problem while saving. Exiting ..." ) ;
+                                                       pingServer.stopPing() ;
+                                                       emergencyStop() ;
+                                                       System.exit( 1 ) ;
+                                               }
                                        } else {
                                                sendSaveOkVM() ;
                                        }
@@ -1515,6 +1532,7 @@ public class Client extends UnicastRemoteObject implements ServicesClient
                                        /* Close streams */
                                        reader.close() ; reader = null ;
                                        socket.close() ; socket = null ;
+                                       System.out.println( "Application is starting." ) ;
                                        
                                        try {
                                                LocalHost.Instance().getServerStub().goApplication() ;
@@ -1526,6 +1544,7 @@ public class Client extends UnicastRemoteObject implements ServicesClient
 
                        } catch( IOException e ) {
                                e.printStackTrace() ;
+                               yield() ;
                        }
                }
        }