Package org.ldaptive
Class SingleConnectionFactory
java.lang.Object
org.ldaptive.DefaultConnectionFactory
org.ldaptive.SingleConnectionFactory
- All Implemented Interfaces:
ConnectionFactory
Creates a single connection which is proxied for LDAP operations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
protected static class
Contains the connection used by this factory. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Connection
The connection used by this factory.private boolean
Whetherinitialize()
should throw if the connection cannot be opened.private boolean
Whetherinitialize()
has been successfully invoked.private ExecutorService
Executor for schedulinginitialize()
.private boolean
Whetherinitialize()
should occur on a separate thread.private Connection
The proxy used by this factory.Fields inherited from class org.ldaptive.DefaultConnectionFactory
logger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.SingleConnectionFactory
(String ldapUrl) Creates a new single connection factory.SingleConnectionFactory
(String ldapUrl, Transport t) Creates a new single connection factory.Creates a new single connection factory.Creates a new single connection factory.Creates a new single connection factory. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder for this class.Creates a builder for this class.void
close()
Free any resources associated with this factory.Creates a new connection.boolean
Returns whetherinitialize()
should throw if the connection cannot be opened.boolean
Returns whetherinitialize()
should execute on a separate thread.void
Prepares this factory for use.private void
Attempts to open the connection and establish the proxy.boolean
Returns whether this factory has been initialized.void
setFailFastInitialize
(boolean b) Sets whetherinitialize()
should throw if the connection cannot be opened.void
setNonBlockingInitialize
(boolean b) Sets whetherinitialize()
should execute on a separate thread.toString()
Methods inherited from class org.ldaptive.DefaultConnectionFactory
getConnectionConfig, getTransport, setConnectionConfig
-
Field Details
-
connection
The connection used by this factory. -
proxy
The proxy used by this factory. -
initialized
private boolean initializedWhetherinitialize()
has been successfully invoked. -
failFastInitialize
private boolean failFastInitializeWhetherinitialize()
should throw if the connection cannot be opened. -
nonBlockingInitialize
private boolean nonBlockingInitializeWhetherinitialize()
should occur on a separate thread. -
initializeExecutor
Executor for schedulinginitialize()
.
-
-
Constructor Details
-
SingleConnectionFactory
public SingleConnectionFactory()Default constructor. -
SingleConnectionFactory
Creates a new single connection factory.- Parameters:
t
- transport
-
SingleConnectionFactory
Creates a new single connection factory.- Parameters:
ldapUrl
- to connect to
-
SingleConnectionFactory
Creates a new single connection factory.- Parameters:
ldapUrl
- to connect tot
- transport
-
SingleConnectionFactory
Creates a new single connection factory.- Parameters:
cc
- connection configuration
-
SingleConnectionFactory
Creates a new single connection factory.- Parameters:
cc
- connection configurationt
- transport
-
-
Method Details
-
getFailFastInitialize
public boolean getFailFastInitialize()Returns whetherinitialize()
should throw if the connection cannot be opened.- Returns:
- whether
initialize()
should throw
-
setFailFastInitialize
public void setFailFastInitialize(boolean b) Sets whetherinitialize()
should throw if the connection cannot be opened.- Parameters:
b
- whetherinitialize()
should throw
-
getNonBlockingInitialize
public boolean getNonBlockingInitialize()Returns whetherinitialize()
should execute on a separate thread.- Returns:
- whether
initialize()
should block
-
setNonBlockingInitialize
public void setNonBlockingInitialize(boolean b) Sets whetherinitialize()
should execute on a separate thread.- Parameters:
b
- whetherinitialize()
should block
-
isInitialized
public boolean isInitialized()Returns whether this factory has been initialized.- Returns:
- whether this factory has been initialized
-
initialize
Prepares this factory for use.- Throws:
LdapException
- if the connection cannot be opened
-
initializeInternal
Attempts to open the connection and establish the proxy.- Throws:
LdapException
- ifConnection.open()
fails andfailFastInitialize
is true
-
getConnection
Description copied from class:DefaultConnectionFactory
Creates a new connection. Connections returned from this method must be opened before they can perform ldap operations.- Specified by:
getConnection
in interfaceConnectionFactory
- Overrides:
getConnection
in classDefaultConnectionFactory
- Returns:
- connection
-
close
public void close()Description copied from interface:ConnectionFactory
Free any resources associated with this factory.- Specified by:
close
in interfaceConnectionFactory
- Overrides:
close
in classDefaultConnectionFactory
-
toString
- Overrides:
toString
in classDefaultConnectionFactory
-
builder
Creates a builder for this class.- Returns:
- new builder
-
builder
Creates a builder for this class.- Parameters:
t
- transport- Returns:
- new builder
-