Class LdapConnFactory
java.lang.Object
com.netscape.certsrv.ldap.LdapConnFactory
- Direct Known Subclasses:
LdapAnonConnFactory, LdapBoundConnFactory
Maintains a pool of connections to the LDAP server.
Multiple threads use this interface to utilize and release
the Ldap connection resources.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringstatic org.slf4j.Loggerprotected LdapConnInfoprotected booleandefault value for the above at init time.protected booleanreturn error if server is down at creation time.protected intprotected intprotected intprotected intnumber of available conns in arrayprotected inttotal num connsstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected netscape.ldap.LDAPSocketFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinalize()intfreeConn()Returns the number of free connections available from this pool.abstract netscape.ldap.LDAPConnectiongetConn()Request access to a Ldap connection from the pool.returns connection info.netscape.ldap.LDAPSocketFactoryintmaxConn()Returns the maximum number of connections available from this pool.abstract voidreset()Used for disconnecting all connections.abstract voidreturnConn(netscape.ldap.LDAPConnection conn) Return connection to the factory.voidsetSocketFactory(netscape.ldap.LDAPSocketFactory socketFactory) intReturns the number of total connections available from this pool.
-
Field Details
-
logger
public static org.slf4j.Logger logger -
PROP_MINCONNS
- See Also:
-
PROP_MAXCONNS
- See Also:
-
PROP_MAXRESULTS
- See Also:
-
PROP_ERROR_IF_DOWN
- See Also:
-
id
-
socketFactory
protected netscape.ldap.LDAPSocketFactory socketFactory -
mConnInfo
-
mMinConns
protected int mMinConns -
mMaxConns
protected int mMaxConns -
mMaxResults
protected int mMaxResults -
mNumConns
protected int mNumConnsnumber of available conns in array -
mTotal
protected int mTotaltotal num conns -
mErrorIfDown
protected boolean mErrorIfDownreturn error if server is down at creation time. -
mDefErrorIfDown
protected boolean mDefErrorIfDowndefault value for the above at init time.
-
-
Constructor Details
-
LdapConnFactory
public LdapConnFactory()
-
-
Method Details
-
getSocketFactory
public netscape.ldap.LDAPSocketFactory getSocketFactory() -
setSocketFactory
public void setSocketFactory(netscape.ldap.LDAPSocketFactory socketFactory) -
getConnInfo
returns connection info. -
reset
Used for disconnecting all connections. Used just before a subsystem shutdown or process exit. -
freeConn
public int freeConn()Returns the number of free connections available from this pool.- Returns:
- Integer number of free connections.
-
totalConn
public int totalConn()Returns the number of total connections available from this pool. Includes sum of free and in use connections.- Returns:
- Integer number of total connections.
-
maxConn
public int maxConn()Returns the maximum number of connections available from this pool.- Returns:
- Integer maximum number of connections.
-
getConn
Request access to a Ldap connection from the pool.- Returns:
- Ldap connection object. connection is not available
- Throws:
ELdapException- if any error occurs, such as a
-
returnConn
Return connection to the factory. mandatory after a getConn().- Parameters:
conn- Ldap connection object to be returned to the free list of the pool.- Throws:
ELdapException- On any failure to return the connection.
-
finalize
-