public class DNSServiceResolverImpl extends Object implements DNSServiceResolver
Modifier and Type | Field and Description |
---|---|
protected Map<String,List<DNSServiceEntry>> |
cache
Create a cache to hold the at most 100 recent DNS lookups for a period of 10 minutes.
|
protected static DirContext |
context |
protected static DNSServiceResolver |
instance |
protected long |
lastCacheUpdate |
static org.apache.commons.logging.Log |
log |
protected long |
maxDelay |
protected static String |
SRV_RECORD |
DNS_CACHE_EXPIRY, LDAP_SERVICE_PREFIX
Modifier | Constructor and Description |
---|---|
protected |
DNSServiceResolverImpl() |
Modifier and Type | Method and Description |
---|---|
static DNSServiceResolver |
getInstance() |
protected List<DNSServiceEntry> |
resolveDnsServiceRecord(String service,
String domain)
Returns the host name and port that a server providing the specified service can be reached at.
|
List<DNSServiceEntry> |
resolveLDAPDomainServers(String domain)
Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup on _ldap._tcp.${domain}.
|
List<DNSServiceEntry> |
resolveLDAPDomainServers(String domain,
String prefix)
Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup using a custom DNS
service prefix.
|
public static final org.apache.commons.logging.Log log
protected static DNSServiceResolver instance
protected static final String SRV_RECORD
protected Map<String,List<DNSServiceEntry>> cache
protected long lastCacheUpdate
protected final long maxDelay
protected static DirContext context
protected DNSServiceResolverImpl()
public static DNSServiceResolver getInstance()
protected List<DNSServiceEntry> resolveDnsServiceRecord(String service, String domain) throws NamingException
As an example, a lookup for "example.com" for the service _gc._tcp may return "dc01.example.com:3268".
service
- the service.domain
- the domain.NamingException
- if the DNS server is unreachablepublic List<DNSServiceEntry> resolveLDAPDomainServers(String domain) throws NamingException
DNSServiceResolver
resolveLDAPDomainServers
in interface DNSServiceResolver
NamingException
public List<DNSServiceEntry> resolveLDAPDomainServers(String domain, String prefix) throws NamingException
DNSServiceResolver
resolveLDAPDomainServers
in interface DNSServiceResolver
prefix
- custom SRV prefix such as "_gc._tcp"NamingException
Copyright © 2017 Nuxeo. All rights reserved.