9 class PingPongTask < MSG::Task
12 puts "Here is the ping pong initializer"
13 #Has No Role, Since Its The Task Class ( Created from C ) tht will be called ,
14 # and any instruction here will be ignored
23 class Sender < MSG::Process
26 MSG::info("Hello from Sender")
28 MSG::info("Host count :" + hostCount.to_s)
31 for i in 0..hostCount-1
33 mailboxes<< MSG::Host.getByName(args[i]).name
35 # FIXME Handel Exceptions
38 for i in 0..hostCount-1
40 MSG::info("sender time :"+time.to_s)
41 task = PingPongTask.new("PingTask",10000,2000)
42 MSG::info("task created :" + task.name);
44 p "mailboxe >>> "+ mailboxes[i]
45 task.send(mailboxes[i])
48 MSG::info("GoodBye !!!")
58 class Receiver < MSG::Process
61 MSG::info("Hello from Receiver")
63 MSG::info("Try to get a task")
64 host = MSG::Host.getHostProcess(self)
65 task = PingPongTask.receive(host.name)
66 p "task name recevied : "+ task.name
67 timeGot = MSG.getClock
68 MSG::info("Got at time: "+timeGot.to_s)
70 MSG::info("Was sent at time "+timeSent.to_s)
71 communicationTime = timeGot - time
72 MSG::info("Communication Time: "+communicationTime.to_s)
73 MSG::info("--- bw "+(100000000/communicationTime).to_s+" ----")
74 MSG::info("GoodBye !!!")
79 #################################################
81 #################################################
84 MSG.createEnvironment(ARGV[0])
85 MSG.deployApplication(ARGV[1])
87 MSG.createEnvironment("ping_pong_platform.xml")
88 MSG.deployApplication("ping_pong_deployment.xml")