Class LdapConnectionPool
- java.lang.Object
-
- org.apache.commons.pool2.BaseObject
-
- org.apache.commons.pool2.impl.BaseGenericObjectPool<T>
-
- org.apache.commons.pool2.impl.GenericObjectPool<LdapConnection>
-
- org.apache.directory.ldap.client.api.LdapConnectionPool
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.commons.pool2.impl.GenericObjectPoolMXBean
,org.apache.commons.pool2.ObjectPool<LdapConnection>
,org.apache.commons.pool2.UsageTracking<LdapConnection>
public class LdapConnectionPool extends org.apache.commons.pool2.impl.GenericObjectPool<LdapConnection>
A pool implementation for LdapConnection objects. This class is just a wrapper around the commons GenericObjectPool, and has a more meaningful name to represent the pool type.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description LdapConnectionPool(org.apache.commons.pool2.PooledObjectFactory<LdapConnection> factory)
Instantiates a new LDAP connection pool.LdapConnectionPool(org.apache.commons.pool2.PooledObjectFactory<LdapConnection> factory, org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
Instantiates a new LDAP connection pool.LdapConnectionPool(LdapConnectionConfig connectionConfig, LdapApiService apiService, long timeout)
Instantiates a new LDAP connection pool.LdapConnectionPool(LdapConnectionConfig connectionConfig, LdapApiService apiService, long timeout, org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
Instantiates a new LDAP connection pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LdapConnection
getConnection()
Gives a LdapConnection fetched from the pool.LdapApiService
getLdapApiService()
Returns the LdapApiService instance used by this connection pool.void
releaseConnection(LdapConnection connection)
Places the given LdapConnection back in the pool.-
Methods inherited from class org.apache.commons.pool2.impl.GenericObjectPool
addObject, borrowObject, borrowObject, clear, close, evict, getFactory, getFactoryType, getLogAbandoned, getMaxIdle, getMinIdle, getNumActive, getNumIdle, getNumWaiters, getRemoveAbandonedOnBorrow, getRemoveAbandonedOnMaintenance, getRemoveAbandonedTimeout, invalidateObject, isAbandonedConfig, listAllObjects, preparePool, returnObject, setAbandonedConfig, setConfig, setMaxIdle, setMinIdle, use
-
Methods inherited from class org.apache.commons.pool2.impl.BaseGenericObjectPool
getBlockWhenExhausted, getBorrowedCount, getCreatedCount, getCreationStackTrace, getDestroyedByBorrowValidationCount, getDestroyedByEvictorCount, getDestroyedCount, getEvictionPolicy, getEvictionPolicyClassName, getEvictorShutdownTimeoutMillis, getFairness, getJmxName, getLifo, getMaxBorrowWaitTimeMillis, getMaxTotal, getMaxWaitMillis, getMeanActiveTimeMillis, getMeanBorrowWaitTimeMillis, getMeanIdleTimeMillis, getMinEvictableIdleTimeMillis, getNumTestsPerEvictionRun, getReturnedCount, getSoftMinEvictableIdleTimeMillis, getSwallowedExceptionListener, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, isClosed, setBlockWhenExhausted, setEvictionPolicy, setEvictionPolicyClassName, setEvictionPolicyClassName, setEvictorShutdownTimeoutMillis, setLifo, setMaxTotal, setMaxWaitMillis, setMinEvictableIdleTimeMillis, setNumTestsPerEvictionRun, setSoftMinEvictableIdleTimeMillis, setSwallowedExceptionListener, setTestOnBorrow, setTestOnCreate, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillis
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.pool2.impl.GenericObjectPoolMXBean
getBlockWhenExhausted, getBorrowedCount, getCreatedCount, getCreationStackTrace, getDestroyedByBorrowValidationCount, getDestroyedByEvictorCount, getDestroyedCount, getFairness, getLifo, getMaxBorrowWaitTimeMillis, getMaxTotal, getMaxWaitMillis, getMeanActiveTimeMillis, getMeanBorrowWaitTimeMillis, getMeanIdleTimeMillis, getMinEvictableIdleTimeMillis, getNumTestsPerEvictionRun, getReturnedCount, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, isClosed
-
-
-
-
Constructor Detail
-
LdapConnectionPool
public LdapConnectionPool(LdapConnectionConfig connectionConfig, LdapApiService apiService, long timeout)
Instantiates a new LDAP connection pool.- Parameters:
connectionConfig
- The connection configurationapiService
- The api service (codec)timeout
- The connection timeout in millis
-
LdapConnectionPool
public LdapConnectionPool(LdapConnectionConfig connectionConfig, LdapApiService apiService, long timeout, org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
Instantiates a new LDAP connection pool.- Parameters:
connectionConfig
- The connection configurationapiService
- The api service (codec)timeout
- The connection timeout in millispoolConfig
- The pool configuration
-
LdapConnectionPool
public LdapConnectionPool(org.apache.commons.pool2.PooledObjectFactory<LdapConnection> factory)
Instantiates a new LDAP connection pool.- Parameters:
factory
- The LDAP connection factory
-
LdapConnectionPool
public LdapConnectionPool(org.apache.commons.pool2.PooledObjectFactory<LdapConnection> factory, org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
Instantiates a new LDAP connection pool.- Parameters:
factory
- The LDAP connection factorypoolConfig
- The pool configuration
-
-
Method Detail
-
getLdapApiService
public LdapApiService getLdapApiService()
Returns the LdapApiService instance used by this connection pool.- Returns:
- The LdapApiService instance used by this connection pool.
-
getConnection
public LdapConnection getConnection() throws LdapException
Gives a LdapConnection fetched from the pool.- Returns:
- an LdapConnection object from pool
- Throws:
LdapException
- if an error occurs while obtaining a connection from the factory
-
releaseConnection
public void releaseConnection(LdapConnection connection) throws LdapException
Places the given LdapConnection back in the pool.- Parameters:
connection
- the LdapConnection to be released- Throws:
LdapException
- if an error occurs while releasing the connection
-
-