Class SharedLdapPool

  • All Implemented Interfaces:
    LdapPool<Ldap>

    public class SharedLdapPool
    extends AbstractLdapPool<Ldap>
    SharedLdapPool implements a pool of ldap objects that has a set minimum and maximum size. The pool will not grow beyond the maximum size and when the pool is exhausted, requests for new objects will be serviced by objects that are already in use. Since Ldap is a thread safe object this implementation leverages that by sharing ldap objects among requests. See LdapContext.newInstance(Control[]). This implementation should be used when you want some control over the maximum number of ldap connections, but can tolerate some new connections under high load. See AbstractLdapPool.
    Version:
    $Revision: 1330 $ $Date: 2010-05-24 00:10:53 +0200 (Mon, 24 May 2010) $
    Author:
    Middleware Services
    • Constructor Detail

      • SharedLdapPool

        public SharedLdapPool()
        Creates a new ldap pool using DefaultLdapFactory.
      • SharedLdapPool

        public SharedLdapPool​(LdapFactory<Ldap> lf)
        Creates a new ldap pool with the supplied ldap factory.
        Parameters:
        lf - ldap factory
      • SharedLdapPool

        public SharedLdapPool​(LdapPoolConfig lpc,
                              LdapFactory<Ldap> lf)
        Creates a new ldap pool with the supplied ldap config and factory.
        Parameters:
        lpc - ldap pool configuration
        lf - ldap factory
    • Method Detail

      • retrieveAvailable

        protected Ldap retrieveAvailable()
        This attempts to retrieve an ldap object from the available queue. This pooling implementation guarantees there is always an object available.
        Returns:
        ldap object from the pool
        Throws:
        java.lang.IllegalStateException - if an object cannot be removed from the available queue
      • checkIn

        public void checkIn​(Ldap l)
        Returns an ldap object to the pool.
        Parameters:
        l - ldap object