Package org.ldaptive
Class PooledConnectionFactory
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.pool.AbstractConnectionPool
org.ldaptive.pool.BlockingConnectionPool
org.ldaptive.PooledConnectionFactory
- All Implemented Interfaces:
ConnectionFactory,Freezable,ConnectionPool
public final class PooledConnectionFactory
extends BlockingConnectionPool
implements ConnectionFactory
Creates connections for performing ldap operations and manages those connections as a pool.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classclassValidation exception handler that attempts to retrieve another connection.Nested classes/interfaces inherited from class org.ldaptive.pool.AbstractConnectionPool
AbstractConnectionPool.DefaultPooledConnectionProxy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ValidationExceptionHandlerValidation exception handler.Fields inherited from class org.ldaptive.pool.AbstractConnectionPool
active, available, checkOutLock, DEFAULT_MAX_POOL_SIZE, DEFAULT_MIN_POOL_SIZE, logger, poolLock, poolNotEmpty -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.PooledConnectionFactory(String ldapUrl) Creates a new pooled connection factory.PooledConnectionFactory(String ldapUrl, Transport t) Creates a new pooled connection factory.Creates a new pooled connection factory.Creates a new pooled connection factory.Creates a new pooled connection factory. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder for this class.Creates a builder for this class.voidclose()Empty this pool, freeing any resources.voidfreeze()Freezes this object, making it immutable.Returns a connection from the pool.Returns the connection configuration used to create connections.Returns the ldap transport.Returns the validation exception handler.voidSets the connection config.voidSets the validation exception handler.toString()Methods inherited from class org.ldaptive.pool.BlockingConnectionPool
blockAvailableConnection, getBlockWaitTime, putConnection, retrieveAvailableConnection, setBlockWaitTimeMethods inherited from class org.ldaptive.pool.AbstractConnectionPool
activateAndValidateConnection, activeCount, availableCount, createActiveConnection, createAvailableConnection, createAvailableConnections, createConnectionProxy, getActivator, getConnectOnCreate, getDefaultConnectionFactory, getFailFastInitialize, getMaxPoolSize, getMinPoolSize, getName, getPassivator, getPooledConnectionStatistics, getPruneStrategy, getQueueType, getValidator, grow, initialize, isInitialized, isValidateOnCheckIn, isValidateOnCheckOut, isValidatePeriodically, passivateAndValidateConnection, prune, removeActiveConnection, removeAvailableAndActiveConnection, removeAvailableConnection, retrieveConnectionProxy, setActivator, setConnectOnCreate, setDefaultConnectionFactory, setFailFastInitialize, setMaxPoolSize, setMinPoolSize, setName, setPassivator, setPruneStrategy, setQueueType, setValidateOnCheckIn, setValidateOnCheckOut, setValidatePeriodically, setValidator, throwIfNotInitialized, validateMethods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, isFrozen
-
Field Details
-
validationExceptionHandler
Validation exception handler. Default implementation retries once.
-
-
Constructor Details
-
PooledConnectionFactory
public PooledConnectionFactory()Default constructor. -
PooledConnectionFactory
Creates a new pooled connection factory.- Parameters:
t- transport
-
PooledConnectionFactory
Creates a new pooled connection factory.- Parameters:
ldapUrl- to connect to
-
PooledConnectionFactory
Creates a new pooled connection factory.- Parameters:
ldapUrl- to connect tot- transport
-
PooledConnectionFactory
Creates a new pooled connection factory.- Parameters:
cc- connection configuration
-
PooledConnectionFactory
Creates a new pooled connection factory.- Parameters:
cc- connection configurationt- transport
-
-
Method Details
-
freeze
public void freeze()Description copied from interface:FreezableFreezes this object, making it immutable.- Specified by:
freezein interfaceFreezable- Overrides:
freezein classAbstractConnectionPool
-
getConnectionConfig
Description copied from interface:ConnectionFactoryReturns the connection configuration used to create connections.- Specified by:
getConnectionConfigin interfaceConnectionFactory- Returns:
- connection config
-
setConnectionConfig
Sets the connection config. Once invoked the supplied connection config is made immutable. SeeConnectionConfig.freeze().- Parameters:
cc- connection config
-
getValidationExceptionHandler
Returns the validation exception handler.- Returns:
- validation exception handler
-
setValidationExceptionHandler
Sets the validation exception handler.- Parameters:
handler- validation exception handler
-
getTransport
Returns the ldap transport.- Returns:
- ldap transport
-
getConnection
Description copied from class:AbstractConnectionPoolReturns a connection from the pool.- Specified by:
getConnectionin interfaceConnectionFactory- Specified by:
getConnectionin interfaceConnectionPool- Overrides:
getConnectionin classBlockingConnectionPool- Returns:
- connection
- Throws:
PoolException- if this operation failsBlockingTimeoutException- if this pool is configured with a block time and it occurs
-
close
public void close()Description copied from class:AbstractConnectionPoolEmpty this pool, freeing any resources.- Specified by:
closein interfaceConnectionFactory- Specified by:
closein interfaceConnectionPool- Overrides:
closein classAbstractConnectionPool
-
toString
- Overrides:
toStringin classBlockingConnectionPool
-
builder
Creates a builder for this class.- Returns:
- new builder
-
builder
Creates a builder for this class.- Parameters:
t- transport- Returns:
- new builder
-