Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use send/recv instead of put/get
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 27 Feb 2010 23:06:16 +0000 (23:06 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 27 Feb 2010 23:06:16 +0000 (23:06 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7137 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/java/ping_pong/PingPongTest.java
examples/java/ping_pong/Receiver.java
examples/java/ping_pong/Sender.java

index f5c3d58..c92750b 100644 (file)
@@ -28,9 +28,6 @@ public class PingPongTest  {
                System.exit(1);
        }
        
-        /* specify a paje output file. */
-        Msg.pajeOutput("ping_pong.trace");
-               
        /* construct the platform and deploy the application */
        Msg.createEnvironment(args[0]);
        Msg.deployApplication(args[1]);
index a35426d..1f0cf4e 100644 (file)
@@ -24,7 +24,7 @@ public class Receiver extends simgrid.msg.Process {
     
       Msg.info("try to get a task");
         
-      PingPongTask task = (PingPongTask)Task.get(0);
+      PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
       double timeGot = Msg.getClock();
       double timeSent = task.getTime();
             
index fd44bb2..846566f 100644 (file)
@@ -1,8 +1,7 @@
 /*
- * $Id$
+ * Sender of basic ping/pong example
  *
- * Copyright 2006,2007 Martin Quinson, Malek Cherier         
- * All rights reserved. 
+ * Copyright 2006,2007,2010 The SimGrid Team. All rights reserved. 
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. 
@@ -21,15 +20,15 @@ public class Sender extends simgrid.msg.Process {
         
        int hostCount = args.length;
         
-       Msg.info("host count : " + hostCount);
-       Host hostTable[] = new Host[hostCount]; 
+       Msg.info("host count: " + hostCount);
+       String mailboxes[] = new String[hostCount]; 
        double time;
        double computeDuration = 0;
        PingPongTask task;
         
        for(int pos = 0; pos < args.length ; pos++) {
          try {
-            hostTable[pos] = Host.getByName(args[pos]);
+            mailboxes[pos] = Host.getByName(args[pos]).getName();
          } catch (HostNotFoundException e) {
             Msg.info("Invalid deployment file: " + e.toString());           
             System.exit(1);
@@ -39,12 +38,12 @@ public class Sender extends simgrid.msg.Process {
         for (int pos = 0; pos < hostCount; pos++) { 
           time = Msg.getClock(); 
             
-          Msg.info("sender time : " + time);
+          Msg.info("sender time: " + time);
           
           task = new PingPongTask("no name",computeDuration,commSizeLat);
           task.setTime(time);
             
-          hostTable[pos].put(0,task);
+          task.send(mailboxes[pos]);
         } 
         
         Msg.info("goodbye!");