Class BlockingLdapPool

  • All Implemented Interfaces:
    LdapPool<Ldap>
    Direct Known Subclasses:
    SoftLimitLdapPool

    public class BlockingLdapPool
    extends AbstractLdapPool<Ldap>
    BlockingLdapPool 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 block. The length of time the pool will block is determined by getBlockWaitTime(). By default the pool will block indefinitely and there is no guarantee that waiting threads will be serviced in the order in which they made their request. This implementation should be used when you need to control the exact number of ldap connections that can be created. See AbstractLdapPool.
    Version:
    $Revision: 2241 $ $Date: 2012-02-07 21:08:51 +0100 (Tue, 07 Feb 2012) $
    Author:
    Middleware Services
    • Constructor Detail

      • BlockingLdapPool

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

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

        public BlockingLdapPool​(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

      • getBlockWaitTime

        public long getBlockWaitTime()
        Returns the block wait time. Default time is 0, which will wait indefinitely.
        Returns:
        time in milliseconds to wait for available ldap objects
      • setBlockWaitTime

        public void setBlockWaitTime​(long time)
        Sets the block wait time. Default time is 0, which will wait indefinitely.
        Parameters:
        time - in milliseconds to wait for available ldap objects
      • retrieveAvailable

        protected Ldap retrieveAvailable()
        This attempts to retrieve an ldap object from the available queue.
        Returns:
        ldap object from the pool
        Throws:
        java.util.NoSuchElementException - if the available queue is empty
      • checkIn

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