Package org.ldaptive
Class DnsResolverConnectionStrategy
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.AbstractConnectionStrategy
org.ldaptive.AbstractPassiveConnectionStrategy
org.ldaptive.DnsResolverConnectionStrategy
- All Implemented Interfaces:
Iterable<LdapURL>,ConnectionStrategy,Freezable
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 DurationDefault time to live for DNS results.private final DurationTime to live for DNS records.private InstantDNS expiration time.Custom iterator function.private StringLDAP 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.voidpopulate(String urls, LdapURLSet urlSet) Populates aLdapURLSetfrom the URL string provided at configuration time.voidsetResolverFunction(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, toStringMethods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, freeze, isFrozenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:ConnectionStrategyPopulates aLdapURLSetfrom the URL string provided at configuration time.- Specified by:
populatein interfaceConnectionStrategy- Overrides:
populatein classAbstractPassiveConnectionStrategy- 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 forDnsSrvConnectionStrategythat use URLs with the schemedns:.urlSet- LDAP URL set to populate.
-
newInstance
Description copied from interface:ConnectionStrategyCreate a deep copy of this strategy.- Returns:
- new instance of this connection strategy
-