private Node getNode(int id) { for (Node n : nodes) { if (id == n.getNodeId()) return n; } throw new RuntimeException("Node not found, id = " + id); }
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(); }
@Override public void process(Message msg) { node.process(msg); }
@Override public void run() { node.run(); }
public BullyWrapperNode(Node node) { super(node.getNodeId()); this.node = node; }