package portal.flow.sample.comm;
import java.io.IOException;
import java.net.UnknownHostException;
import portal.flow.sample.comm.bus.Bus;
import portal.util.Logger;
public class ProcessB extends Thread {
private String p0id;
private Bus bus;
public ProcessB(String p0id) throws UnknownHostException, IOException {
this.p0id = p0id;
this.bus = new Bus("queue");
}
public void setP0id(String p0id) {
Logger.log("B setPid : "+p0id);
this.p0id = p0id;
}
public void run() {
Logger.log("B started!");
for (int i = 0; i < 10; i++)
send(i,p0id);
}
public void send(int x, String p0id) {
Logger.log("B preparing send");
try {
Thread.sleep(3000);
} catch (Exception ex) {}
Logger.log("B sending ->"+x);
try {
bus.send(x);
} catch (Exception e) {
e.printStackTrace();
}
//Portal.next(pid);
}
}