Package org.ldaptive
Class DnsResolverConnectionStrategy
java.lang.Object
org.ldaptive.AbstractConnectionStrategy
org.ldaptive.DnsResolverConnectionStrategy
- All Implemented Interfaces:
Iterable<LdapURL>
,ConnectionStrategy
Connection strategy that tries all IP addresses resolved from DNS. The order of IP addressees returned can be
controlled via the java.net.preferIPv4Stack or java.net.preferIPv6Addresses system property flags. This strategy
operates in an active/passive fashion.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ldaptive.AbstractConnectionStrategy
AbstractConnectionStrategy.DefaultLdapURLIterator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Duration
Default time to live for DNS results.private final Duration
Time to live for DNS records.private Instant
DNS expiration time.Custom iterator function.private String
LDAP URL string used to initialize this strategy.private Function<String,
InetAddress[]> Name resolver function.Fields inherited from class org.ldaptive.AbstractConnectionStrategy
ldapURLSet, logger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Creates a new DNS resolver connection strategy.Creates a new DNS connection strategy.Creates a new DNS resolver connection strategy. -
Method Summary
Modifier and TypeMethodDescriptionReturns the name resolution function.iterator()
Create a deep copy of this strategy.void
populate
(String urls, LdapURLSet urlSet) Populates aLdapURLSet
from the URL string provided at configuration time.void
setResolverFunction
(Function<String, InetAddress[]> func) Sets the function used to resolve names.Methods inherited from class org.ldaptive.AbstractConnectionStrategy
failure, getActivateCondition, getRetryCondition, initialize, isInitialized, setRetryCondition, success, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
DEFAULT_TTL
Default time to live for DNS results. -
iterFunction
Custom iterator function. -
dnsTtl
Time to live for DNS records. -
resolverFunction
Name resolver function. -
ldapUrls
LDAP URL string used to initialize this strategy. -
expirationTime
DNS expiration time.
-
-
Constructor Details
-
DnsResolverConnectionStrategy
public DnsResolverConnectionStrategy()Default constructor. -
DnsResolverConnectionStrategy
Creates a new DNS resolver connection strategy.- Parameters:
ttl
- time to live for DNS records
-
DnsResolverConnectionStrategy
Creates a new DNS connection strategy.- Parameters:
function
- that produces a custom iterator
-
DnsResolverConnectionStrategy
public DnsResolverConnectionStrategy(Function<List<LdapURL>, Iterator<LdapURL>> function, Duration ttl) Creates a new DNS resolver connection strategy.- Parameters:
function
- that produces a custom iteratorttl
- time to live for DNS records
-
-
Method Details
-
getResolverFunction
Returns the name resolution function.- Returns:
- name resolution function
-
setResolverFunction
Sets the function used to resolve names.- Parameters:
func
- to set
-
iterator
-
populate
Description copied from interface:ConnectionStrategy
Populates aLdapURLSet
from the URL string provided at configuration time.- Specified by:
populate
in interfaceConnectionStrategy
- Overrides:
populate
in classAbstractConnectionStrategy
- Parameters:
urls
- Space-delimited string of URLs describing the LDAP hosts to connect to. The URLs in the string are commonlyldap://
orldaps://
URLs that directly describe the hosts to connect to, but may also describe a resource from which to obtain LDAP connection URLs as is the case forDnsSrvConnectionStrategy
that use URLs with the schemedns:
.urlSet
- LDAP URL set to populate.
-
newInstance
Description copied from interface:ConnectionStrategy
Create a deep copy of this strategy.- Returns:
- new instance of this connection strategy
-