コード例 #1
0
  public void joinChordRing() throws MiddlewareIOException {
    BootNodeRepons bootPeerRespons = udpSender.findBootNode();

    if (bootPeerRespons == null) {
      this.isBootPeer = true;
      System.out.println("No boot peer found.");
    } else {
      System.out.println("Boot peer found at " + bootPeerRespons.getIp().getHostName());
      System.out.println("GUID: " + bootPeerRespons.getGuid());
      udpReceiver.startBootNodeService();
    }

    tcpListener.setIsBootPeer(isBootPeer);
    tcpListener.start();

    if (!isBootPeer) {
      Hashtable<Integer, PeerReference> routingTable =
          requester.requestRoutingTable(bootPeerRespons.getIp());
      System.out.println(routingTable.size());
    }
  }