code: static List<String> loadDnsRecords(final String serviceName, final DirContext ctx) throws NamingException {
          Attributes attrs = ctx.getAttributes(serviceName, new String[] { "SRV" });
          NamingEnumeration<?> servers = attrs.get("srv").getAll();
          List<String> records = new ArrayList<String>();
          while (servers.hasMore()) {
              DnsRecord record = DnsRecord.fromString((String) servers.next());
              records.add(record.getHost());
          }
          return records;
      }
docs: Helper method to load a list of DNS SRV records.
  
  @param serviceName the service to locate.
  @param ctx the directory context to fetch from.
  @return the list of dns records
  @throws NamingException if something goes wrong during the load process.