Package org.ldaptive
Class ConnectionConfig
java.lang.Object
org.ldaptive.AbstractConfig
org.ldaptive.ConnectionConfig
Contains all the configuration data needed to control connections.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Whether to automatically reconnect to the server when a connection is lost.private Predicate<RetryMetadata>
Condition used to determine whether another reconnect attempt should be made.private boolean
Whether pending operations should be replayed after a reconnect.private ConnectionInitializer[]
Connection initializers to execute onConnection.open()
.private ConnectionStrategy
Connection strategy.private ConnectionValidator
Connection validator.private Duration
Duration of time that connects will block.static final Predicate<RetryMetadata>
Predicate that attempts to reconnect forever, waiting for 5 seconds after the first attempt.static final Predicate<RetryMetadata>
Predicate that attempts to reconnect forever, backing off in 5 second intervals after the first attempt.private String
URL to the LDAP(s).static final Predicate<RetryMetadata>
Predicate that attempts a single reconnect.private Duration
Duration of time that operations will block on reconnects, should generally be longer thanconnectTimeout
.private Duration
Duration of time to wait for responses.private SslConfig
Configuration for SSL and startTLS connections.Transport options.private boolean
Connect to LDAP using startTLS.Fields inherited from class org.ldaptive.AbstractConfig
logger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ConnectionConfig
(String url) Creates a new connection config. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConnectionConfig.Builder
builder()
Creates a builder for this class.static ConnectionConfig
copy
(ConnectionConfig config) Returns a new connection config initialized with the supplied config.boolean
Returns whether connections will attempt to reconnect.Returns the auto reconnect condition.boolean
Returns whether operations should be replayed after a reconnect.Returns the connection initializers.Returns the connection strategy.Returns the connection validator.Returns the connect timeout.Returns the ldap url.Returns the reconnect timeout.Returns the response timeout.Returns the ssl config.Returns a transport option.Returns transport options.boolean
Returns whether startTLS will be used for connections.void
setAutoReconnect
(boolean b) Sets whether connections will attempt to reconnect when unexpectedly closed.void
setAutoReconnectCondition
(Predicate<RetryMetadata> predicate) Sets the auto reconnect condition.void
setAutoReplay
(boolean b) Sets whether operations will be replayed after a reconnect.void
setConnectionInitializers
(ConnectionInitializer... initializers) Sets the connection initializers.void
setConnectionStrategy
(ConnectionStrategy strategy) Sets the connection strategy.void
setConnectionValidator
(ConnectionValidator validator) Sets the connection validator.void
setConnectTimeout
(Duration time) Sets the maximum amount of time that connects will block.void
setLdapUrl
(String url) Sets the ldap url.void
setReconnectTimeout
(Duration time) Sets the maximum amount of time that operations will block waiting for a reconnect.void
setResponseTimeout
(Duration time) Sets the maximum amount of time that operations will wait for a response.void
setSslConfig
(SslConfig config) Sets the ssl config.void
setTransportOption
(String id, Object value) Sets a transport option.void
setTransportOptions
(Map<String, ?> options) Sets transport options.void
setUseStartTLS
(boolean b) Sets whether startTLS will be used for connections.toString()
Methods inherited from class org.ldaptive.AbstractConfig
checkArrayContainsNull, checkImmutable, checkStringInput, makeImmutable
-
Field Details
-
ONE_RECONNECT_ATTEMPT
Predicate that attempts a single reconnect. -
INFINITE_RECONNECT_ATTEMPTS
Predicate that attempts to reconnect forever, waiting for 5 seconds after the first attempt. -
INFINITE_RECONNECT_ATTEMPTS_WITH_BACKOFF
Predicate that attempts to reconnect forever, backing off in 5 second intervals after the first attempt. -
ldapUrl
URL to the LDAP(s). -
connectTimeout
Duration of time that connects will block. -
responseTimeout
Duration of time to wait for responses. -
reconnectTimeout
Duration of time that operations will block on reconnects, should generally be longer thanconnectTimeout
. -
autoReconnect
private boolean autoReconnectWhether to automatically reconnect to the server when a connection is lost. Default is true. -
autoReconnectCondition
Condition used to determine whether another reconnect attempt should be made. Default makes a single attempt only if the connection was previously opened. -
autoReplay
private boolean autoReplayWhether pending operations should be replayed after a reconnect. Default is true. -
sslConfig
Configuration for SSL and startTLS connections. -
useStartTLS
private boolean useStartTLSConnect to LDAP using startTLS. -
connectionInitializers
Connection initializers to execute onConnection.open()
. -
connectionStrategy
Connection strategy. -
connectionValidator
Connection validator. -
transportOptions
Transport options.
-
-
Constructor Details
-
ConnectionConfig
public ConnectionConfig()Default constructor. -
ConnectionConfig
Creates a new connection config.- Parameters:
url
- to connect to
-
-
Method Details
-
getLdapUrl
Returns the ldap url.- Returns:
- ldap url
-
setLdapUrl
Sets the ldap url.- Parameters:
url
- of the ldap
-
getConnectTimeout
Returns the connect timeout.- Returns:
- timeout
-
setConnectTimeout
Sets the maximum amount of time that connects will block.- Parameters:
time
- timeout for connects
-
getResponseTimeout
Returns the response timeout.- Returns:
- timeout
-
setResponseTimeout
Sets the maximum amount of time that operations will wait for a response.- Parameters:
time
- timeout for responses
-
getReconnectTimeout
Returns the reconnect timeout.- Returns:
- timeout
-
setReconnectTimeout
Sets the maximum amount of time that operations will block waiting for a reconnect.- Parameters:
time
- timeout for reconnects
-
getAutoReconnect
public boolean getAutoReconnect()Returns whether connections will attempt to reconnect.- Returns:
- whether to automatically reconnect when a connection is lost
-
setAutoReconnect
public void setAutoReconnect(boolean b) Sets whether connections will attempt to reconnect when unexpectedly closed.- Parameters:
b
- whether to automatically reconnect when a connection is lost
-
getAutoReconnectCondition
Returns the auto reconnect condition.- Returns:
- auto reconnect condition
-
setAutoReconnectCondition
Sets the auto reconnect condition.- Parameters:
predicate
- to determine whether to attempt a reconnect
-
getAutoReplay
public boolean getAutoReplay()Returns whether operations should be replayed after a reconnect.- Returns:
- whether to auto replay
-
setAutoReplay
public void setAutoReplay(boolean b) Sets whether operations will be replayed after a reconnect.- Parameters:
b
- whether to replay operations
-
getSslConfig
Returns the ssl config.- Returns:
- ssl config
-
setSslConfig
Sets the ssl config.- Parameters:
config
- ssl config
-
getUseStartTLS
public boolean getUseStartTLS()Returns whether startTLS will be used for connections.- Returns:
- whether startTLS will be used
-
setUseStartTLS
public void setUseStartTLS(boolean b) Sets whether startTLS will be used for connections.- Parameters:
b
- whether startTLS will be used
-
getConnectionInitializers
Returns the connection initializers.- Returns:
- connection initializers
-
setConnectionInitializers
Sets the connection initializers.- Parameters:
initializers
- connection initializers
-
getConnectionStrategy
Returns the connection strategy.- Returns:
- strategy for making connections
-
setConnectionStrategy
Sets the connection strategy.- Parameters:
strategy
- for making new connections
-
getConnectionValidator
Returns the connection validator.- Returns:
- connection validator
-
setConnectionValidator
Sets the connection validator.- Parameters:
validator
- for validating connections
-
getTransportOptions
Returns transport options.- Returns:
- transport options
-
setTransportOptions
Sets transport options.- Parameters:
options
- to set
-
getTransportOption
Returns a transport option.- Parameters:
id
- transport option id- Returns:
- transport option
-
setTransportOption
Sets a transport option.- Parameters:
id
- of the transport optionvalue
- of the transport option
-
copy
Returns a new connection config initialized with the supplied config.- Parameters:
config
- connection config to read properties from- Returns:
- connection config
-
toString
-
builder
Creates a builder for this class.- Returns:
- new builder
-