Example #1
0
  private Node getNode(int id) {
    for (Node n : nodes) {
      if (id == n.getNodeId()) return n;
    }

    throw new RuntimeException("Node not found, id = " + id);
  }
Example #2
0
  public void addNode(Node node) {
    if (node == null) return;

    if (node instanceof BullyNode) {
      ((BullyNode) node).setTransport(transport);
      transport.addNode(node);
    } else {
      BullyWrapperNode b = new BullyWrapperNode(node);
      b.setTransport(transport);
      transport.addNode(b);
    }

    if (!node.isAlive()) node.start();
  }
Example #3
0
 @Override
 public void process(Message msg) {
   node.process(msg);
 }
Example #4
0
 @Override
 public void run() {
   node.run();
 }
Example #5
0
 public BullyWrapperNode(Node node) {
   super(node.getNodeId());
   this.node = node;
 }