From: Samuel Lepetit Date: Fri, 4 May 2012 08:21:23 +0000 (+0200) Subject: Bugfix in async example. maybe our code should be more defensive for that kind of... X-Git-Tag: v3_9_90~569^2~19^2~110 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2a48d6322f6b2ef7867b484e1f5820f0d4201be8 Bugfix in async example. maybe our code should be more defensive for that kind of case, since it can crash simgrid without the user understanding why. --- diff --git a/examples/async/Master.java b/examples/async/Master.java index e7a89f25b1..88d6d1249e 100644 --- a/examples/async/Master.java +++ b/examples/async/Master.java @@ -33,7 +33,6 @@ public class Master extends Process { //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."); diff --git a/examples/async/Slave.java b/examples/async/Slave.java index e2865a74b9..f1a8fabcf8 100644 --- a/examples/async/Slave.java +++ b/examples/async/Slave.java @@ -37,14 +37,16 @@ public class Slave extends Process { Task task = comm.getTask(); if (task instanceof FinalizeTask) { + comm = null; break; } Msg.info("Received \"" + task.getName() + "\". Processing it."); try { task.execute(); } catch (TaskCancelledException e) { - + } + comm = null; } else { simulatedSleep(1); @@ -52,7 +54,7 @@ public class Slave extends Process { } } catch (Exception e) { - + e.printStackTrace(); } } Msg.info("Received Finalize. I'm done. See you!"); diff --git a/src/jmsg.c b/src/jmsg.c index 9bf60c8fad..f1328c482a 100644 --- a/src/jmsg.c +++ b/src/jmsg.c @@ -547,7 +547,6 @@ Java_org_simgrid_msg_MsgNative_taskCreate(JNIEnv * env, jclass cls, task = MSG_task_create(name, (double) jcomputeDuration, (double) jmessageSize, NULL); - XBT_INFO("Name: %s %p",name,task); if (jname) (*env)->ReleaseStringUTFChars(env, jname, name);