JEP 418: Internet-Address Resolution SPI

OwnerAleksej Efimov
StatusClosed / Delivered
Componentcore-libs /
Discussionnet dash dev at openjdk dot java dot net
Reviewed byAlan Bateman, Brian Goetz, Chris Hegarty, Daniel Fuchs
Endorsed byBrian Goetz
Created2021/03/16 16:43
Updated2022/09/09 10:29


Define a service-provider interface (SPI) for host name and address resolution, so that can make use of resolvers other than the platform's built-in resolver.



The API resolves host names to Internet Protocol (IP) addresses, and vice versa. The API currently uses the operating system's native resolver, which is typically configured to use a combination of a local hosts file and the Domain Name System (DNS).

Motivations for defining a service-provider interface for name and address resolution include:


The InetAddress API defines multiple methods for lookup operations:

By default, InetAddress uses the operating system's native resolver to perform lookups. The result of that lookup, whether positive or negative, may be cached in order to avoid further lookups of the same host.

Service-provider interface

The InetAddress API will use a service loader to locate a resolver provider. If no provider is found, the built-in implementation will be used as before.

The new classes in the package are:


Without an SPI such as the one proposed here, applications will have to continue to use the workarounds available today.


We will develop new tests for the resolver SPI.

We will develop proof-of-concept resolver providers to demonstrate and verify that the SPI can be used to develop and deploy alternative implementations that are used in preference to the JDK's built-in implementation. We will make at least one of these providers available to seed development of more complete implementations.