Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correction of the start application time setup.
authorSébastien Miquée <sebastien.miquee@univ-fcomte.fr>
Wed, 3 Aug 2011 00:00:48 +0000 (02:00 +0200)
committerSébastien Miquée <sebastien.miquee@univ-fcomte.fr>
Wed, 3 Aug 2011 00:00:48 +0000 (02:00 +0200)
src/and/hpcvm/Client.java
src/and/hpcvm/RunningApplication.java
src/and/hpcvm/Server.java

index 232a58c..e3233eb 100644 (file)
@@ -1532,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() ;
index 5e79522..c3307de 100644 (file)
@@ -15,6 +15,7 @@ public class RunningApplication implements Serializable
        private boolean running ;
        private long startTime ;
        private long endTime ;
+       private boolean start_mark ;
        
        public RunningApplication( String _name )
        {
@@ -22,10 +23,14 @@ public class RunningApplication implements Serializable
                computingsNodes = new ArrayList<ComputingClient>() ;
                lastSaveDate = 0 ;
                running = false ;
-               startTime = 0 ;
+               startTime = -1 ;
                endTime = 0 ;
+               start_mark = false ;
        }
        
+       public void setStartMark() { start_mark = true ; }
+       
+       public boolean getStartMark() { return start_mark ; } 
        
        public void clear() { computingsNodes.clear() ; }
        
index 7c31580..390d580 100644 (file)
@@ -841,7 +841,7 @@ public class Server extends UnicastRemoteObject implements ServicesServer
                        {
                                app.setComputingClients( tmp ) ;
                                app.setRunning( true ) ;
-//                             app.setStartTime( System.currentTimeMillis() ) ;
+                               app.setStartTime( System.currentTimeMillis() ) ;
                                
                                int index, index2 ;
                                /* Choosing save neighbors */
@@ -1055,11 +1055,14 @@ public class Server extends UnicastRemoteObject implements ServicesServer
        public void goApplication()
        {
                synchronized( applications ) {
-               if( running && applications.get( ind ).getStartTime() != 0 )
-               {
-                       applications.get( ind ).setStartTime( System.currentTimeMillis() ) ;
-                       applications.get( ind ).setLastSaveDate( System.currentTimeMillis() ) ;
-               }}
+                       if( running && ! applications.get( ind ).getStartMark() )
+                       {
+                               System.out.println( "Application is starting." ) ;
+                               applications.get( ind ).setStartMark() ;
+                               applications.get( ind ).setStartTime( System.currentTimeMillis() ) ;
+                               applications.get( ind ).setLastSaveDate( System.currentTimeMillis() ) ;
+                       }
+               }
        }