A resolver provider is a factory for custom implementations of InetAddress resolvers. A resolver defines operations for looking up (resolving) host names and IP addresses.
A resolver provider is a concrete subclass of this class that has a zero-argument constructor and implements the abstract methods specified below.
A given invocation of the Java virtual machine maintains a single
system-wide resolver instance, which is used by
InetAddress. It is set after the VM is fully initialized and when an
invocation of a method in
InetAddress class triggers the first lookup
A resolver provider is located and loaded by
InetAddress to create the system-wide resolver as follows:
ServiceLoadermechanism is used to locate an
InetAddressResolverProviderusing the system class loader. The order in which providers are located is implementation specific. The first provider found will be used to instantiate the
InetAddressResolverby invoking the
get(InetAddressResolverProvider.Configuration)method. The returned
InetAddressResolverwill be set as the system-wide resolver.
- If the previous step fails to find any resolver provider the built-in resolver will be set as the system-wide resolver.
If instantiating a custom resolver from a provider discovered in step 1 throws an error or exception, the system-wide resolver will not be set and the error or exception will be propagated to the caller of the method that triggered the lookup operation. Otherwise, any lookup operation will be performed using the system-wide resolver.
- Implementation Note:
InetAddresswill use the built-in resolver for any lookup operation that might occur before the VM is fully booted.
Nested Class Summary
protectedCreates a new instance of
InetAddressResolverProviderprotected InetAddressResolverProvider()Creates a new instance of
- Implementation Note:
- It is recommended that an
InetAddressResolverProviderservice implementation initialization should be as simple as possible, in order to avoid possible risks of deadlock or class loading cycles during the instantiation of the service provider.
SecurityException- if a security manager is present and its
checkPermissionmethod doesn't allow the
getInitialize and return an
InetAddressResolverprovided by this provider. This method is called by
InetAddresswhen installing the system-wide resolver implementation.
Any error or exception thrown by this method is considered as a failure of
InetAddressResolverinstantiation and will be propagated to the caller of the method that triggered the lookup operation.
InetAddressResolverProvider.Configurationinstance containing platform built-in address resolution configuration.
- the resolver provided by this provider
namepublic abstract String name()Returns the name of this provider, or
- the name of this provider, or