HADOOP-15764. [JDK10] Migrate from sun.net.dns.ResolverConfiguration to the replacement. Contributed by Akira Ajisaka.
This commit is contained in:
parent
3da94a36e2
commit
429a07e08c
@ -318,6 +318,10 @@
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>dnsjava</groupId>
|
||||
<artifactId>dnsjava</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Add optional runtime dependency on the in-development timeline server module
|
||||
@ -773,19 +777,6 @@
|
||||
<exclude>ehcache-core.xsd</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
|
||||
<!-- remove utility classes which are not required from
|
||||
dnsjava -->
|
||||
<filter>
|
||||
<artifact>dnsjava:dnsjava</artifact>
|
||||
<excludes>
|
||||
<excldue>dig*</excldue>
|
||||
<exclude>jnamed*</exclude>
|
||||
<exlcude>lookup*</exlcude>
|
||||
<exclude>update*</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
|
||||
</filters>
|
||||
|
||||
<!-- relocate classes from mssql-jdbc -->
|
||||
|
@ -212,6 +212,17 @@
|
||||
<exclude>ccache.txt</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
<!-- remove utility classes which are not required from
|
||||
dnsjava -->
|
||||
<filter>
|
||||
<artifact>dnsjava:dnsjava</artifact>
|
||||
<excludes>
|
||||
<exclude>dig*</exclude>
|
||||
<exclude>jnamed*</exclude>
|
||||
<exclude>lookup*</exclude>
|
||||
<exclude>update*</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
|
@ -324,6 +324,11 @@
|
||||
<artifactId>mockwebserver</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dnsjava</groupId>
|
||||
<artifactId>dnsjava</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -27,6 +27,7 @@
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -52,8 +53,9 @@
|
||||
import org.apache.hadoop.util.ZKUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
//this will need to be replaced someday when there is a suitable replacement
|
||||
import sun.net.dns.ResolverConfiguration;
|
||||
import org.xbill.DNS.Name;
|
||||
import org.xbill.DNS.ResolverConfig;
|
||||
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.net.InetAddresses;
|
||||
@ -584,9 +586,14 @@ public InetAddress getByName(String host) throws UnknownHostException {
|
||||
* hadoop.security.token.service.use_ip=false
|
||||
*/
|
||||
protected static class QualifiedHostResolver implements HostResolver {
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<String> searchDomains =
|
||||
ResolverConfiguration.open().searchlist();
|
||||
private List<String> searchDomains;
|
||||
{
|
||||
ResolverConfig resolverConfig = ResolverConfig.getCurrentConfig();
|
||||
searchDomains = new ArrayList<>();
|
||||
for (Name name : resolverConfig.searchPath()) {
|
||||
searchDomains.add(name.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an InetAddress with a fully qualified hostname of the given
|
||||
|
Loading…
Reference in New Issue
Block a user