X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2033091e2339a120d594b4cbf81a89d72faa0d05..04c44fbe77163cca75366d10e35ba400b804eaef:/examples/java/ping_pong/Sender.java diff --git a/examples/java/ping_pong/Sender.java b/examples/java/ping_pong/Sender.java index 332329bdf5..17f2dfd267 100644 --- a/examples/java/ping_pong/Sender.java +++ b/examples/java/ping_pong/Sender.java @@ -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. @@ -15,38 +14,36 @@ public class Sender extends simgrid.msg.Process { private final double commSizeLat = 1; final double commSizeBw = 100000000; - public void main(String[] args) throws JniException, NativeException { + public void main(String[] args) throws MsgException { Msg.info("hello!"); 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); } } - Channel channel = new Channel(0); - 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); - channel.put(task, hostTable[pos]); + task.send(mailboxes[pos]); } Msg.info("goodbye!");