a process once simulation has started using Java bindings.
examples/master_slave_bypass/Master.java
examples/master_slave_bypass/MsBypass.java
examples/master_slave_bypass/Slave.java
+ examples/master_slave_bypass/FinalizeTask.java
)
set(CMAKE_SRC
--- /dev/null
+/*
+ * 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.
+ */
+
+package master_slave_bypass;
+import org.simgrid.msg.Task;
+
+public class FinalizeTask extends Task {
+ public FinalizeTask() {
+ super("finalize",0,0);
+ }
+}
+
\ No newline at end of file
import org.simgrid.msg.Msg;
import org.simgrid.msg.MsgException;
import org.simgrid.msg.Process;
+import org.simgrid.msg.Task;
+
+import master_slave_bypass.FinalizeTask;
public class Master extends Process {
public Master(String hostname, String name) throws HostNotFoundException {
super(hostname, name);
}
public void main(String[] args) throws MsgException {
- Msg.info("Master Hello!");
-/* try {
+ Msg.info("Master Hello!");
+
+ //Create a slave on host "alice"
+ try {
+ Msg.info("Create process on host 'alice'");
Slave process2 = new Slave("alice","process2");
}
catch (MsgException e){
- System.out.println("Mes couilles!!!!!");
- } */
+ System.out.println("Process2!");
+ }
+
+ //Wait for slave "alice"
+ while(true)
+ {
+ Task task = Task.receive("alice");
+ if (task instanceof FinalizeTask) {
+ Msg.info("Received Finalize. I'm done. See you!");
+ break;
+ }
+ }
}
}
/* bypass deploymemt */
try {
Master process1 = new Master("bob","process1");
- Slave process2 = new Slave("alice","process2");
}
catch (MsgException e){
- System.out.println("Mes couilles!!!!!");
+ System.out.println("Create processes failed!");
}
/* execute the simulation. */
import org.simgrid.msg.TransferFailureException;
import org.simgrid.msg.Process;
+import master_slave_bypass.FinalizeTask;
+
public class Slave extends Process {
public Slave(String hostname, String name) throws HostNotFoundException {
super(hostname, name);
}
public void main(String[] args) throws TransferFailureException, HostFailureException, TimeoutException {
Msg.info("Slave Hello!");
+ FinalizeTask task = new FinalizeTask();
+ Msg.info("Send finalize!");
+ task.send("alice");
}
}
\ No newline at end of file
<AS id="AS0" routing="Full">
<host id="bob" power="137333000"/>
<host id="alice" power="98095000"/>
+ <host id="nono" power="98095000"/>
<link id="1" bandwidth="100000000" latency="0.001"/>
+ <link id="2" bandwidth="100000000" latency="0.001"/>
+ <link id="3" bandwidth="100000000" latency="0.001"/>
<route src="bob"
dst="alice"
symmetrical="YES">
<link_ctn id="1"/>
+ </route>
+ <route src="alice"
+ dst="nono"
+ symmetrical="YES">
+ <link_ctn id="2"/>
+ </route>
+ <route src="bob"
+ dst="nono"
+ symmetrical="YES">
+ <link_ctn id="3"/>
</route>
</AS>
</platform>
\ No newline at end of file