public class PooledLDAPConnectionFactory extends Object implements org.apache.commons.pool.PoolableObjectFactory
PooledLDAPConnections
within the commons-pool library. Handles creating, configuring,
connecting, securing, and binding the connections as they pass
in and out of the pool.LdapConnectionManager,
LdapConnectionManagerConfig| Constructor and Description |
|---|
PooledLDAPConnectionFactory() |
| Modifier and Type | Method and Description |
|---|---|
void |
activateObject(Object obj)
Activates a PooledLDAPConnection as it is being loaned out from the
pool, including: ensuring the default constraints are set and
setting the active flag so that it can return itself to the pool
if it falls out of scope.
|
void |
destroyObject(Object obj)
Cleans up a PooledLDAPConnection that is about to be destroyed by
invoking
LDAPConnection.disconnect(). |
LdapConnectionLivenessValidator |
getConnectionLivenessValidator()
Access the strategy for verifying
LDAPConnection
liveness. |
LdapConnectionManager |
getConnectionManager()
Gives the LdapConnectionMananger that the Factory is using
to configure its PooledLDAPConnections.
|
protected String |
getHost()
Get the host to connect to.
|
Object |
makeObject()
Constructs a new PooledLDAPConnection object, including:
passing it the connection manager so it can return itself
to the pool if it falls out of scope, setting a default
set of constraints, connecting to the server, initiating
TLS if needed.
|
protected PooledLDAPConnection |
newConnection() |
protected LdapConnectionLivenessValidator |
newDefaultConnectionLivenessValidator()
As implemented, will return a new
NativeLdapConnectionLivenessValidator. |
void |
passivateObject(Object obj)
Passivates a PooledLDAPConnection as it is being returned to
the pool, including: clearing the active flag so that it won't
attempt to return itself to the pool.
|
void |
setConnectionLivenessValidator(LdapConnectionLivenessValidator livenessValidator)
Assign a strategy for verifying
LDAPConnection
liveness. |
void |
setConnectionManager(LdapConnectionManager connectionManager)
Sets the LdapConnectionManager that the Factory will use
to configure and manage its PooledLDAPConnections.
|
boolean |
validateObject(Object obj)
Validates a PooledLDAPConnection by checking if the connection
is alive and ensuring it is properly bound as the autoBind user.
|
public Object makeObject() throws com.novell.ldap.LDAPException
makeObject in interface org.apache.commons.pool.PoolableObjectFactorycom.novell.ldap.LDAPExceptionprotected PooledLDAPConnection newConnection()
public void activateObject(Object obj) throws com.novell.ldap.LDAPException
activateObject in interface org.apache.commons.pool.PoolableObjectFactorycom.novell.ldap.LDAPExceptionpublic void passivateObject(Object obj) throws com.novell.ldap.LDAPException
passivateObject in interface org.apache.commons.pool.PoolableObjectFactorycom.novell.ldap.LDAPExceptionpublic boolean validateObject(Object obj)
validateObject in interface org.apache.commons.pool.PoolableObjectFactorypublic void destroyObject(Object obj) throws Exception
LDAPConnection.disconnect(). To ensure that the
object is not inadvertently returned to the pool again by a
finalize() call, the connection's active flag is lowered
prior to the disconnect() call. Does nothing but log a pair of
debug messages if the received object is not a PooledLDAPConnection.destroyObject in interface org.apache.commons.pool.PoolableObjectFactoryExceptionpublic LdapConnectionManager getConnectionManager()
public void setConnectionManager(LdapConnectionManager connectionManager)
connectionManager - the LdapConnectionManager to usepublic void setConnectionLivenessValidator(LdapConnectionLivenessValidator livenessValidator)
LDAPConnection
liveness. Defaults to an instance of
NativeLdapConnectionLivenessValidator.livenessValidator - an object implementing a
liveness validation strategy. Pass null
to force default behavior.protected LdapConnectionLivenessValidator newDefaultConnectionLivenessValidator()
NativeLdapConnectionLivenessValidator.LdapConnectionLivenessValidator strategy.public LdapConnectionLivenessValidator getConnectionLivenessValidator()
LDAPConnection
liveness. Will not return null.protected String getHost()
Copyright © 2003–2022 Sakai Project. All rights reserved.