class Platform {

  @Nullable public String linkLocalIp() {
    // uses synchronized variant of double-checked locking as getting the endpoint can be expensive
    if (linkLocalIp != null) return linkLocalIp;
    synchronized (this) {
      if (linkLocalIp == null) {
        linkLocalIp = produceLinkLocalIp();
      }
    }
    return linkLocalIp;
  }

}