private void resolve ( String hostname , List < InetAddress > inetAddresses ) throws NamingException , UnknownHostException { if ( preferIpv6 || ( ! preferIpv4 && ! preferIpv6 ) ) { inetAddresses . addAll ( resolve ( hostname , "AAAA" ) ) ; inetAddresses . addAll ( resolve ( hostname , "A" ) ) ; } else { inetAddresses . addAll ( resolve ( hostname , "A" ) ) ; inetAddresses . addAll ( resolve ( hostname , "AAAA" ) ) ; } if ( inetAddresses . isEmpty ( ) ) { inetAddresses . addAll ( resolveCname ( hostname ) ) ; } }
Resolve a hostname