public void join() { // No known node, this node starts new network with just this node in it predecessor = new NodeInfo(ip, port, id); // Itself successor = new NodeInfo(ip, port, id); // Itself // Fill finger table with just this for (int i = 0; i < 16; i++) { fingers[i] = new NodeInfo(ip, port, id); } // createTimerCheckPredecessor(); System.out.println("New network created"); System.out.println("Check the node at status at " + thisNode.getIndex()); listenToRequests(); }
public void join(String ip, int port) { // n is existing known node to bootstrap into the network System.out.println(this.port + ": Joining"); // Initialize own successor/predecessors successor = requestSender.findIdSuccessor(ip, port, thisNode.getID()); // No ID needed for path predecessor = requestSender.getNodePredecessor(successor); takeResponsibilities(); // createTimerCheckPredecessor(); initFingerTable(ip, port); listenToRequests(); System.out.println(this.port + ": Listening"); // Update successors and predecessor with this node updateOthers(); System.out.println("Join complete!"); System.out.println("Check the node at status at " + thisNode.getIndex()); }