Class LdapConnectionPool

java.lang.Object
org.apache.commons.pool2.BaseObject
org.apache.commons.pool2.impl.BaseGenericObjectPool<LdapConnection>
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
  • Field Summary

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

    abandonedConfig, MEAN_TIMING_STATS_CACHE_SIZE
  • 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, org.apache.directory.api.ldap.codec.api.LdapApiService apiService, long timeout)
    Instantiates a new LDAP connection pool.
    LdapConnectionPool(LdapConnectionConfig connectionConfig, org.apache.directory.api.ldap.codec.api.LdapApiService apiService, long timeout, org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
    Instantiates a new LDAP connection pool.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gives a LdapConnection fetched from the pool.
    org.apache.directory.api.ldap.codec.api.LdapApiService
    Returns the LdapApiService instance used by this connection pool.
    void
    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, toStringAppendFields, use

    Methods inherited from class org.apache.commons.pool2.impl.BaseGenericObjectPool

    getBlockWhenExhausted, getBorrowedCount, getCollectDetailedStatistics, getCreatedCount, getCreationStackTrace, getDestroyedByBorrowValidationCount, getDestroyedByEvictorCount, getDestroyedCount, getDurationBetweenEvictionRuns, getEvictionPolicy, getEvictionPolicyClassName, getEvictorShutdownTimeout, getEvictorShutdownTimeoutDuration, getEvictorShutdownTimeoutMillis, getFairness, getJmxName, getLifo, getLogAbandoned, getMaxBorrowWaitDuration, getMaxBorrowWaitTimeMillis, getMaxTotal, getMaxWaitDuration, getMaxWaitMillis, getMeanActiveDuration, getMeanActiveTimeMillis, getMeanBorrowWaitDuration, getMeanBorrowWaitTimeMillis, getMeanIdleDuration, getMeanIdleTimeMillis, getMessageStatistics, getMinEvictableIdleDuration, getMinEvictableIdleTime, getMinEvictableIdleTimeMillis, getNumTestsPerEvictionRun, getRemoveAbandonedOnBorrow, getRemoveAbandonedOnMaintenance, getRemoveAbandonedTimeout, getRemoveAbandonedTimeoutDuration, getReturnedCount, getSoftMinEvictableIdleDuration, getSoftMinEvictableIdleTime, getSoftMinEvictableIdleTimeMillis, getSwallowedExceptionListener, getTestOnBorrow, getTestOnCreate, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRuns, getTimeBetweenEvictionRunsMillis, isAbandonedConfig, isClosed, markReturningState, setAbandonedConfig, setBlockWhenExhausted, setCollectDetailedStatistics, setConfig, setDurationBetweenEvictionRuns, setEvictionPolicy, setEvictionPolicyClassName, setEvictionPolicyClassName, setEvictorShutdownTimeout, setEvictorShutdownTimeoutMillis, setLifo, setMaxTotal, setMaxWait, setMaxWaitMillis, setMessagesStatistics, setMinEvictableIdle, setMinEvictableIdleDuration, setMinEvictableIdleTime, setMinEvictableIdleTimeMillis, setNumTestsPerEvictionRun, setSoftMinEvictableIdle, setSoftMinEvictableIdleDuration, setSoftMinEvictableIdleTime, setSoftMinEvictableIdleTimeMillis, setSwallowedExceptionListener, setTestOnBorrow, setTestOnCreate, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRuns, setTimeBetweenEvictionRunsMillis

    Methods inherited from class org.apache.commons.pool2.BaseObject

    toString

    Methods inherited from class Object

    clone, equals, finalize, 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, 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 Details

    • LdapConnectionPool

      public LdapConnectionPool(LdapConnectionConfig connectionConfig, org.apache.directory.api.ldap.codec.api.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, org.apache.directory.api.ldap.codec.api.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 Details

    • getLdapApiService

      public org.apache.directory.api.ldap.codec.api.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 org.apache.directory.api.ldap.model.exception.LdapException
      Gives a LdapConnection fetched from the pool.
      Returns:
      an LdapConnection object from pool
      Throws:
      org.apache.directory.api.ldap.model.exception.LdapException - if an error occurs while obtaining a connection from the factory
    • releaseConnection

      public void releaseConnection(LdapConnection connection) throws org.apache.directory.api.ldap.model.exception.LdapException
      Places the given LdapConnection back in the pool.
      Parameters:
      connection - the LdapConnection to be released
      Throws:
      org.apache.directory.api.ldap.model.exception.LdapException - if an error occurs while releasing the connection