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 classprotected static classContains the connection used by this factory. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ConnectionThe connection used by this factory.private booleanWhetherinitialize()should throw if the connection cannot be opened.private booleanWhetherinitialize()has been successfully invoked.private ExecutorServiceExecutor for schedulinginitialize().private booleanWhetherinitialize()should occur on a separate thread.private ConnectionThe 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.voidclose()Free any resources associated with this factory.Creates a new connection.booleanReturns whetherinitialize()should throw if the connection cannot be opened.booleanReturns whetherinitialize()should execute on a separate thread.voidPrepares this factory for use.private voidAttempts to open the connection and establish the proxy.booleanReturns whether this factory has been initialized.voidsetFailFastInitialize(boolean b) Sets whetherinitialize()should throw if the connection cannot be opened.voidsetNonBlockingInitialize(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 andfailFastInitializeis true
-
getConnection
Description copied from class:DefaultConnectionFactoryCreates a new connection. Connections returned from this method must be opened before they can perform ldap operations.- Specified by:
getConnectionin interfaceConnectionFactory- Overrides:
getConnectionin classDefaultConnectionFactory- Returns:
- connection
-
close
public void close()Description copied from interface:ConnectionFactoryFree any resources associated with this factory.- Specified by:
closein interfaceConnectionFactory- Overrides:
closein classDefaultConnectionFactory
-
toString
- Overrides:
toStringin classDefaultConnectionFactory
-
builder
Creates a builder for this class.- Returns:
- new builder
-
builder
Creates a builder for this class.- Parameters:
t- transport- Returns:
- new builder
-