Class AbstractPoolableLdapConnectionFactory
java.lang.Object
org.apache.directory.ldap.client.api.AbstractPoolableLdapConnectionFactory
- All Implemented Interfaces:
org.apache.commons.pool2.PooledObjectFactory<LdapConnection>
- Direct Known Subclasses:
DefaultPoolableLdapConnectionFactory, ValidatingPoolableLdapConnectionFactory
public abstract class AbstractPoolableLdapConnectionFactory
extends Object
implements org.apache.commons.pool2.PooledObjectFactory<LdapConnection>
An abstract class implementing the PoolableObjectFactory, for LdapConnections.
- Author:
- Apache Directory Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LdapConnectionFactoryThe factory to use to create a new connectionprotected LdapConnectionValidatorThe validator to use -
Constructor Summary
ConstructorsConstructorDescriptionAbstractPoolableLdapConnectionFactory(LdapConnectionFactory connectionFactory) Constructor that takes a LdapConnection factory for poolable connections -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) There is nothing to do to activate a connection.voiddestroyObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) Destroying a connection will unbind it which will result on a shutdown of teh underlying protocol.org.apache.directory.api.ldap.codec.api.LdapApiServiceReturns the LdapApiService instance used by this factory.org.apache.commons.pool2.PooledObject<LdapConnection> Specifically, we are creating a new connection based on the LdapConnection Factory we used to create this pool of connections.protected static LdapConnectionFactorynewLdapConnectionFactory(LdapConnectionConfig config, Class<? extends LdapConnectionFactory> connectionFactoryClass) Create a new LdapConnectionFactory instancevoidpassivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) We don't do anything with the connection.voidsetValidator(LdapConnectionValidator validator) Sets the validator to use when validation occurs.booleanvalidateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) Validating a connection is done by checking the connection status.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.pool2.PooledObjectFactory
destroyObject
-
Field Details
-
connectionFactory
The factory to use to create a new connection -
validator
The validator to use
-
-
Constructor Details
-
AbstractPoolableLdapConnectionFactory
Constructor that takes a LdapConnection factory for poolable connections- Parameters:
connectionFactory- The Ldap connection factory to use
-
-
Method Details
-
activateObject
public void activateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) throws org.apache.directory.api.ldap.model.exception.LdapException There is nothing to do to activate a connection.- Specified by:
activateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>- Throws:
org.apache.directory.api.ldap.model.exception.LdapException
-
destroyObject
public void destroyObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) throws org.apache.directory.api.ldap.model.exception.LdapException Destroying a connection will unbind it which will result on a shutdown of teh underlying protocol.- Specified by:
destroyObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>- Throws:
org.apache.directory.api.ldap.model.exception.LdapException
-
getLdapApiService
public org.apache.directory.api.ldap.codec.api.LdapApiService getLdapApiService()Returns the LdapApiService instance used by this factory.- Returns:
- The LdapApiService instance used by this factory
-
makeObject
public org.apache.commons.pool2.PooledObject<LdapConnection> makeObject() throws org.apache.directory.api.ldap.model.exception.LdapExceptionSpecifically, we are creating a new connection based on the LdapConnection Factory we used to create this pool of connections. The default is to create bound connections.- Specified by:
makeObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If unable to connect.
-
newLdapConnectionFactory
protected static LdapConnectionFactory newLdapConnectionFactory(LdapConnectionConfig config, Class<? extends LdapConnectionFactory> connectionFactoryClass) Create a new LdapConnectionFactory instance- Parameters:
config- The connection configuration to useconnectionFactoryClass- The factory class to use- Returns:
- An instance of LdapConnectionFactory
-
passivateObject
public void passivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) throws org.apache.directory.api.ldap.model.exception.LdapException We don't do anything with the connection. It remains in the state it was before being used.- Specified by:
passivateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If unable to reconfigure and rebind.
-
setValidator
Sets the validator to use when validation occurs. Note that validation will only occur if the connection pool was configured to validate. This means one of:setTestOnBorrowsetTestWhileIdlesetTestOnReturn
LookupLdapConnectionValidator.- Parameters:
validator- The validator
-
validateObject
Validating a connection is done by checking the connection status.- Specified by:
validateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
-