RFR: 8244202: Implementation of JEP 418: Internet-Address Resolution SPI [v5]
Alan Bateman
alanb at openjdk.java.net
Wed Oct 20 18:36:20 UTC 2021
On Wed, 20 Oct 2021 11:52:38 GMT, Aleksei Efimov <aefimov at openjdk.org> wrote:
>> This change implements a new service provider interface for host name and address resolution, so that java.net.InetAddress API can make use of resolvers other than the platform's built-in resolver.
>>
>> The following API classes are added to `java.net.spi` package to facilitate this:
>> - `InetAddressResolverProvider` - abstract class defining a service, and is, essentially, a factory for `InetAddressResolver` resolvers.
>> - `InetAddressResolverProvider.Configuration ` - an interface describing the platform's built-in configuration for resolution operations that could be used to bootstrap a resolver construction, or to implement partial delegation of lookup operations.
>> - `InetAddressResolver` - an interface that defines methods for the fundamental forward and reverse lookup operations.
>> - `InetAddressResolver.LookupPolicy` - a class whose instances describe the characteristics of one forward lookup operation.
>>
>> More details in [JEP-418](https://openjdk.java.net/jeps/418).
>>
>> Testing: new and existing `tier1:tier3` tests
>
> Aleksei Efimov has updated the pull request incrementally with one additional commit since the last revision:
>
> Change InetAddressResolver method names
src/java.base/share/classes/java/net/InetAddress.java line 340:
> 338:
> 339: /* Used to store the system-wide resolver */
> 340: private static volatile InetAddressResolver resolver;
Can this be @Stable?
src/java.base/share/classes/java/net/spi/InetAddressResolver.java line 34:
> 32:
> 33: /**
> 34: * This interface defines operations for looking-up host names and IP addresses.
I think change "looking-up" to "looking up".
src/java.base/share/classes/java/net/spi/InetAddressResolver.java line 102:
> 100:
> 101: /**
> 102: * Specifies if IPv4 addresses need to be queried during lookup.
It might be better to change this to "Characteristic value signifying ..." rather than "Specifies".
src/java.base/share/classes/java/net/spi/InetAddressResolver.java line 186:
> 184:
> 185: /**
> 186: * Returns an integer value which specifies lookup operation characteristics.
I think I'd change the first line here to something like "Returns a set of characteristics of this lookup policy".
src/java.base/share/classes/java/net/spi/InetAddressResolverProvider.java line 35:
> 33: /**
> 34: * A resolver provider class is a factory for custom implementations of {@linkplain
> 35: * InetAddressResolver resolvers} which define operations for looking-up (resolving) host names
This reads "custom implementations of resolvers". It might be better to start with "Service-provider class for InetAddress resolvers".
src/java.base/share/classes/java/net/spi/InetAddressResolverProvider.java line 52:
> 50: /**
> 51: * Initialise and return the {@link InetAddressResolver} provided by
> 52: * this provider. This method is called by {@link InetAddress} when
"the InetAddressResolver" suggests there is just one instance. That is probably the case but I don't think you want to be restricted to that.
src/java.base/share/classes/java/net/spi/InetAddressResolverProvider.java line 88:
> 86: * {@code RuntimePermission("inetAddressResolverProvider")}.
> 87: * @implNote It is recommended that an {@code InetAddressResolverProvider} service
> 88: * implementation does not perform any heavy initialization in its
"heavy initialization" is probably not the best phrase here. Maybe it should say that the initialisation should be as simple as possible to avoid recursive initialisation issues.
src/java.base/share/classes/java/net/spi/InetAddressResolverProvider.java line 110:
> 108: /**
> 109: * A {@code Configuration} interface is supplied to the
> 110: * {@link InetAddressResolverProvider#get(Configuration)} method when installing a
I think this should be "Configuration object" rather than "interface" here.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5822
More information about the core-libs-dev
mailing list