Class 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
    • Field Summary

      • Fields inherited from class org.apache.commons.pool2.impl.BaseGenericObjectPool

        MEAN_TIMING_STATS_CACHE_SIZE
    • 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, borrowObject, clear, close, evict, getFactory, getFactoryType, getMaxIdle, getMinIdle, getNumActive, getNumIdle, getNumWaiters, invalidateObject, invalidateObject, listAllObjects, preparePool, returnObject, setConfig, setMaxIdle, setMinIdle, use
      • Methods inherited from class org.apache.commons.pool2.impl.BaseGenericObjectPool

        getBlockWhenExhausted, getBorrowedCount, getCreatedCount, getCreationStackTrace, getDestroyedByBorrowValidationCount, getDestroyedByEvictorCount, getDestroyedCount, getDurationBetweenEvictionRuns, getEvictionPolicy, getEvictionPolicyClassName, getEvictorShutdownTimeout, getEvictorShutdownTimeoutDuration, getEvictorShutdownTimeoutMillis, getFairness, getJmxName, getLifo, getLogAbandoned, getMaxBorrowWaitTimeMillis, getMaxTotal, getMaxWaitDuration, getMaxWaitMillis, getMeanActiveTimeMillis, getMeanBorrowWaitTimeMillis, getMeanIdleTimeMillis, getMessageStatistics, getMinEvictableIdleDuration, getMinEvictableIdleTime, getMinEvictableIdleTimeMillis, getNumTestsPerEvictionRun, getRemoveAbandonedOnBorrow, getRemoveAbandonedOnMaintenance, getRemoveAbandonedTimeout, getRemoveAbandonedTimeoutDuration, getReturnedCount, getSoftMinEvictableIdleDuration, getSoftMinEvictableIdleTime, getSoftMinEvictableIdleTimeMillis, getSwallowedExceptionListener, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRuns, getTimeBetweenEvictionRunsMillis, isAbandonedConfig, isClosed, setAbandonedConfig, setBlockWhenExhausted, setEvictionPolicy, setEvictionPolicyClassName, setEvictionPolicyClassName, setEvictorShutdownTimeout, setEvictorShutdownTimeoutMillis, setLifo, setMaxTotal, setMaxWait, setMaxWaitMillis, setMessagesStatistics, setMinEvictableIdle, setMinEvictableIdleTime, setMinEvictableIdleTimeMillis, setNumTestsPerEvictionRun, setSoftMinEvictableIdle, setSoftMinEvictableIdleTime, setSoftMinEvictableIdleTimeMillis, setSwallowedExceptionListener, setTestOnBorrow, setTestOnCreate, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRuns, setTimeBetweenEvictionRunsMillis
      • Methods inherited from class org.apache.commons.pool2.BaseObject

        toString
      • Methods inherited from interface org.apache.commons.pool2.impl.GenericObjectPoolMXBean

        getBlockWhenExhausted, getBorrowedCount, getCreatedCount, getCreationStackTrace, getDestroyedByBorrowValidationCount, getDestroyedByEvictorCount, getDestroyedCount, getFairness, getLifo, getLogAbandoned, getMaxBorrowWaitTimeMillis, getMaxTotal, getMaxWaitMillis, getMeanActiveTimeMillis, getMeanBorrowWaitTimeMillis, getMeanIdleTimeMillis, getMinEvictableIdleTimeMillis, getNumTestsPerEvictionRun, getRemoveAbandonedOnBorrow, getRemoveAbandonedOnMaintenance, getRemoveAbandonedTimeout, getReturnedCount, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, isAbandonedConfig, isClosed
      • Methods inherited from interface org.apache.commons.pool2.ObjectPool

        addObjects
    • Constructor Detail

      • LdapConnectionPool

        public LdapConnectionPool​(LdapConnectionConfig connectionConfig,
                                  LdapApiService apiService,
                                  long timeout)
        Instantiates a new LDAP connection pool.
        Parameters:
        connectionConfig - The connection configuration
        apiService - 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 configuration
        apiService - The api service (codec)
        timeout - The connection timeout in millis
        poolConfig - 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 factory
        poolConfig - 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.
      • 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