Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bugfix in async example. maybe our code should be more defensive for that kind of...
authorSamuel Lepetit <samuel.lepetit@inria.fr>
Fri, 4 May 2012 08:21:23 +0000 (10:21 +0200)
committerSamuel Lepetit <samuel.lepetit@inria.fr>
Fri, 4 May 2012 08:21:23 +0000 (10:21 +0200)
examples/async/Master.java
examples/async/Slave.java
src/jmsg.c

index e7a89f2..88d6d12 100644 (file)
@@ -33,7 +33,6 @@ public class Master extends Process {
                        //Msg.info("Sending \"" + task.getName()+ "\" to \"slave_" + i % slavesCount + "\"");
                        task.send("slave_"+(i%slavesCount));
                }
                        //Msg.info("Sending \"" + task.getName()+ "\" to \"slave_" + i % slavesCount + "\"");
                        task.send("slave_"+(i%slavesCount));
                }
-               simulatedSleep(1);
 
                Msg.info("All tasks have been dispatched. Let's tell (asynchronously) everybody the computation is over, and sleep 20s so that nobody gets a message from a terminated process.");
 
 
                Msg.info("All tasks have been dispatched. Let's tell (asynchronously) everybody the computation is over, and sleep 20s so that nobody gets a message from a terminated process.");
 
index e2865a7..f1a8fab 100644 (file)
@@ -37,14 +37,16 @@ public class Slave extends Process {
                                                Task task = comm.getTask();
        
                                                if (task instanceof FinalizeTask) {
                                                Task task = comm.getTask();
        
                                                if (task instanceof FinalizeTask) {
+                                                       comm = null;
                                                        break;
                                                }
                                                Msg.info("Received \"" + task.getName() +  "\". Processing it.");
                                                try {
                                                        task.execute();
                                                } catch (TaskCancelledException e) {
                                                        break;
                                                }
                                                Msg.info("Received \"" + task.getName() +  "\". Processing it.");
                                                try {
                                                        task.execute();
                                                } catch (TaskCancelledException e) {
-                                                       
+                                               
                                                }
                                                }
+                                               comm = null;                                                    
                                        }
                                        else {
                                                simulatedSleep(1);
                                        }
                                        else {
                                                simulatedSleep(1);
@@ -52,7 +54,7 @@ public class Slave extends Process {
                                }
                        }
                        catch (Exception e) {
                                }
                        }
                        catch (Exception e) {
-
+                               e.printStackTrace();
                        }
                }
                Msg.info("Received Finalize. I'm done. See you!");
                        }
                }
                Msg.info("Received Finalize. I'm done. See you!");
index 9bf60c8..f1328c4 100644 (file)
@@ -547,7 +547,6 @@ Java_org_simgrid_msg_MsgNative_taskCreate(JNIEnv * env, jclass cls,
   task =
       MSG_task_create(name, (double) jcomputeDuration,
                       (double) jmessageSize, NULL);
   task =
       MSG_task_create(name, (double) jcomputeDuration,
                       (double) jmessageSize, NULL);
-  XBT_INFO("Name: %s %p",name,task);
   if (jname)
     (*env)->ReleaseStringUTFChars(env, jname, name);
 
   if (jname)
     (*env)->ReleaseStringUTFChars(env, jname, name);