Package portal.flow.sample.comm

Source Code of portal.flow.sample.comm.ProcessB

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);
  }

}
TOP

Related Classes of portal.flow.sample.comm.ProcessB

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.