Ejemplo n.º 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();
      }
    }
  }