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
-
-
Constructor Summary
Constructors Constructor Description AbstractPoolableLdapConnectionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection)
There is nothing to do to activate a connection.void
destroyObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection)
Destroying a connection will unbind it which will result on a shutdown of teh underlying protocol.LdapApiService
getLdapApiService()
Returns the LdapApiService instance used by this factory.org.apache.commons.pool2.PooledObject<LdapConnection>
makeObject()
Specifically, we are creating a new connection based on the LdapConnection Factory we used to create this pool of connections.void
passivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection)
We don't do anything with the connection.void
setValidator(LdapConnectionValidator validator)
Sets the validator to use when validation occurs.boolean
validateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection)
Validating a connection is done by checking the connection status.
-
-
-
Constructor Detail
-
AbstractPoolableLdapConnectionFactory
public AbstractPoolableLdapConnectionFactory()
-
-
Method Detail
-
activateObject
public void activateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) throws LdapException
There is nothing to do to activate a connection.- Specified by:
activateObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
- Throws:
LdapException
-
destroyObject
public void destroyObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) throws LdapException
Destroying a connection will unbind it which will result on a shutdown of teh underlying protocol.- Specified by:
destroyObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
- Throws:
LdapException
-
getLdapApiService
public 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 LdapException
Specifically, 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:
makeObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
- Throws:
LdapException
- If unable to connect.
-
passivateObject
public void passivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection) throws LdapException
We don't do anything with the connection. It remains in the state it was before being used.- Specified by:
passivateObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
- Throws:
LdapException
- If unable to reconfigure and rebind.
-
setValidator
public void setValidator(LdapConnectionValidator validator)
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:setTestOnBorrow
setTestWhileIdle
setTestOnReturn
LookupLdapConnectionValidator
.- Parameters:
validator
- The validator
-
validateObject
public boolean validateObject(org.apache.commons.pool2.PooledObject<LdapConnection> connection)
Validating a connection is done by checking the connection status.- Specified by:
validateObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
-
-