private List lookup()

in src/main/java/com/spotify/ffwd/http/SrvServerList.java [53:78]


  private List<Server> lookup() {
    final Lookup lookup;
    try {
      lookup = new Lookup(record, Type.SRV, DClass.IN);
    } catch (TextParseException e) {
      throw new RuntimeException(e);
    }

    final Record[] result = lookup.run();

    if (lookup.getResult() != Lookup.SUCCESSFUL) {
      throw new RuntimeException(
        "DNS lookup failed: " + lookup.getErrorString() + ": " + record);
    }

    final List<Server> results = new ArrayList<>();

    if (result != null) {
      for (final Record a : result) {
        final SRVRecord srv = (SRVRecord) a;
        results.add(new Server(srv.getTarget().canonicalize().toString(), srv.getPort()));
      }
    }

    return Collections.unmodifiableList(results);
  }