On 6 September 2011 19:02, sebb <[email protected]> wrote:

>>     /**
>>      * Creates a new client connection operator for the given scheme 
>> registry.
>>      *
>> @@ -100,6 +105,26 @@ public class DefaultClientConnectionOper
>>             throw new IllegalArgumentException("Scheme registry amy not be 
>> null");
>>         }
>>         this.schemeRegistry = schemes;
>> +        this.dnsResolver = null;
>
> Could replace this with a default resolver that did
>
>     return InetAddress.getAllByName(host);
>
>> +    }

Good idea.


>     public OperatedClientConnection createConnection() {
> @@ -233,6 +258,10 @@ public class DefaultClientConnectionOper
>      * Resolves the given host name to an array of corresponding IP 
> addresses, based on the
>      * configured name service on the system.
>      *
> +     * If a custom DNS resolver is provided, the given host will be searched 
> in
> +     * it first. If the host is not configured, the default OS DNS-lookup
> +     * mechanism is used.
> +     *
>      * @param host host name to resolve
>      * @return array of IP addresses
>      * @exception  UnknownHostException  if no IP address for the host could 
> be determined.
> @@ -240,7 +269,11 @@ public class DefaultClientConnectionOper
>      * @since 4.1
>      */
>     protected InetAddress[] resolveHostname(final String host) throws 
> UnknownHostException {
> -        return InetAddress.getAllByName(host);
> +        if (dnsResolver != null) {
> +            return dnsResolver.resolve(host);
> +        } else {
> +            return InetAddress.getAllByName(host);
> +        }

This javadoc should be corrected, into something like:

 /**
     * Resolves the given host name to an array of corresponding IP
addresses, based on the
     * configured name service on the provided DNS resolver. If one
wasn't provided, the system
     * configuration is used.
     *
     * @param host host name to resolve
     * @return array of IP addresses
     * @exception  UnknownHostException  if no IP address for the host
could be determined.
     *
     * @see {@link DnsResolver}
     * @see {@link SystemDefaultDnsResolver}
     * @since 4.1
     */

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to