protected def contactPointString()

in management-cluster-bootstrap/src/main/scala/org/apache/pekko/management/cluster/bootstrap/SelfAwareJoinDecider.scala [38:73]


  protected def contactPointString(contactPoint: (String, Int)): String =
    contactPoint.productIterator.mkString(":")

  protected def contactPointString(contactPoint: ResolvedTarget): String =
    s"${contactPoint.host}:${contactPoint.port.getOrElse("0")}"

  /**
   * The value `ClusterBootstrap(system).selfContactPoints` is set prior
   * to HTTP binding, during [[pekko.management.scaladsl.PekkoManagement.start()]], hence we
   * accept blocking on this initialization. If no value is received, the future will fail with
   * a `TimeoutException` and ClusterBootstrap will log an explanatory error to the user.
   */
  private[bootstrap] def selfContactPoint: (String, Int) =
    Await.result(
      ClusterBootstrap(system).selfContactPoint
        .map(uri => (uri.authority.host.toString, uri.authority.port))(system.dispatcher),
      Duration.Inf // the future has a timeout
    )

  /**
   * Determines whether it has the need and ability to join self and create a new cluster.
   */
  private[bootstrap] def canJoinSelf(target: ResolvedTarget, info: SeedNodesInformation): Boolean = {
    val self = selfContactPoint
    if (matchesSelf(target, self)) true
    else {
      if (!info.contactPoints.exists(matchesSelf(_, self))) {
        log.warning(
          BootstrapLogMarker.inProgress(info.contactPoints.map(contactPointString), info.allSeedNodes),
          "Self contact point [{}] not found in targets {}",
          contactPointString(selfContactPoint),
          info.contactPoints.mkString(", "))
      }
      false
    }
  }