Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to remove remaining blockers
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 11 Aug 2016 08:18:27 +0000 (10:18 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 11 Aug 2016 08:18:27 +0000 (10:18 +0200)
examples/java/cloud/masterworker/Worker.java
examples/java/cloud/masterworker/cloud_masterworker.tesh
examples/msg/app-bittorrent/peer.c
teshsuite/java/SleepHostOff/SleepHostOff.java

index 2220730..cf09aa9 100644 (file)
@@ -20,20 +20,18 @@ public class Worker extends Process {
   }
 
   public void main(String[] args) throws MsgException {
   }
 
   public void main(String[] args) throws MsgException {
-    Msg.info(this.getName() +" is listenning on MBOX:WRK0"+ number);
+    Msg.info(this.getName() +" is listening on MBOX:WRK0"+ number);
     while(true) {
     while(true) {
-      Task task;
+      Task task =null;
       try {
         task = Task.receive("MBOX:WRK0"+number);
       try {
         task = Task.receive("MBOX:WRK0"+number);
+        if (task == null)
+          break;
       } catch (MsgException e) {
         Msg.debug("Received failed. I'm done. See you!");
       } catch (MsgException e) {
         Msg.debug("Received failed. I'm done. See you!");
-        break;
       }
       Msg.info("Received \"" + task.getName() +  "\". Processing it.");
       }
       Msg.info("Received \"" + task.getName() +  "\". Processing it.");
-      try {
-        task.execute();
-      } catch (MsgException e) {
-      }
+      task.execute();
       Msg.info(this.getName() +" executed task (" + task.getName()+")");
     }
   }
       Msg.info(this.getName() +" executed task (" + task.getName()+")");
     }
   }
index 1ae841a..1aca080 100644 (file)
@@ -12,8 +12,8 @@ $ java -classpath ${classpath:=.} cloud/masterworker/Main ${srcdir:=.}/../platfo
 > [  0.000000] (1:Master@Jacquelin) Launched 2 VMs
 > [  0.000000] (1:Master@Jacquelin) Send a first batch of work to everyone
 > [  0.000000] (1:Master@Jacquelin) Sending to WRK00
 > [  0.000000] (1:Master@Jacquelin) Launched 2 VMs
 > [  0.000000] (1:Master@Jacquelin) Send a first batch of work to everyone
 > [  0.000000] (1:Master@Jacquelin) Sending to WRK00
-> [  0.000000] (2:WRK00@VM00) WRK00 is listenning on MBOX:WRK00
-> [  0.000000] (3:WRK01@VM01) WRK01 is listenning on MBOX:WRK01
+> [  0.000000] (2:WRK00@VM00) WRK00 is listening on MBOX:WRK00
+> [  0.000000] (3:WRK01@VM01) WRK01 is listening on MBOX:WRK01
 > [  0.892161] (1:Master@Jacquelin) Sending to WRK01
 > [  0.892161] (2:WRK00@VM00) Received "Task00". Processing it.
 > [  0.892161] (2:WRK00@VM00) WRK00 executed task (Task00)
 > [  0.892161] (1:Master@Jacquelin) Sending to WRK01
 > [  0.892161] (2:WRK00@VM00) Received "Task00". Processing it.
 > [  0.892161] (2:WRK00@VM00) WRK00 executed task (Task00)
index 09fd875..de9affa 100644 (file)
@@ -619,10 +619,12 @@ void update_choked_peers(peer_t peer)
           i++;
         }
         xbt_dict_cursor_free(&cursor);
           i++;
         }
         xbt_dict_cursor_free(&cursor);
-        if ((peer_choosed->interested == 0) ||
-            (peer_choosed->choked_upload == 0)) {
+        if (peer_choosed == NULL)
+          THROWF(unknown_error, 0, "A peer should have be selected at this point");
+        else if ((peer_choosed->interested == 0) || (peer_choosed->choked_upload == 0))
           peer_choosed = NULL;
           peer_choosed = NULL;
-        }
+        else
+          XBT_DEBUG("Nothing to do, keep going");
         j++;
       } while (peer_choosed == NULL && j < MAXIMUM_PAIRS);
     } else {
         j++;
       } while (peer_choosed == NULL && j < MAXIMUM_PAIRS);
     } else {
index e57fb4a..c48cca7 100644 (file)
@@ -14,13 +14,15 @@ class Sleeper extends Process {
     super(host,name,args);
   }
   public void main(String[] args) {
     super(host,name,args);
   }
   public void main(String[] args) {
-    while (true) {
+    boolean stillAlive = true;
+    while (stillAlive) {
       Msg.info("I'm not dead");
       try {
         Process.sleep(10);
       Msg.info("I'm not dead");
       try {
         Process.sleep(10);
+        stillAlive = true;
       } catch (HostFailureException e) {
       } catch (HostFailureException e) {
+        stillAlive = false;
         Msg.info("catch HostException: "+e.getLocalizedMessage());
         Msg.info("catch HostException: "+e.getLocalizedMessage());
-        break; //Break is needed to finalize the endless loop 
       }
     }
   }
       }
     }
   }