コード例 #1
0
  /**
   * Initialize the bootstrap node to be running so that every other node can connect through this
   * node
   */
  public void launchBootstrapNode() {
    try {
      /* Try to load the state from file */
      this.bootstrapInstance = JSocialKademliaNode.loadFromFile(BOOTSTRAP_OWNER_ID);

    } catch (IOException | ClassNotFoundException ex) {
      /* Loading state from file failed: create a new instance */
      System.err.println("Loading state from file failed; message: " + ex.getMessage());
      try {
        /* Create a new instance */
        this.bootstrapInstance =
            new JSocialKademliaNode(
                BOOTSTRAP_OWNER_ID, new KademliaId("BOOTSTRAPBOOTSTRAPBO"), BOOTSTRAP_NODE_PORT);
      } catch (IOException exx) {
        exx.printStackTrace();
      }
    }
  }
コード例 #2
-1
  /** Show the bootstrap node data Display the contacts data Display the content data */
  private void populateData() {
    contacts.removeAll();
    contacts.setText(bootstrapInstance.getRoutingTable().toString());
    contacts.setWrapStyleWord(true);
    contacts.setLineWrap(true);

    content.removeAll();
    content.setText(bootstrapInstance.getDHT().toString());
    content.setWrapStyleWord(true);
    content.setLineWrap(true);
  }