Package edu.vt.middleware.ldap.pool
Class SharedLdapPool
- java.lang.Object
-
- edu.vt.middleware.ldap.pool.AbstractLdapPool<Ldap>
-
- edu.vt.middleware.ldap.pool.SharedLdapPool
-
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. SinceLdap
is a thread safe object this implementation leverages that by sharing ldap objects among requests. SeeLdapContext.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. SeeAbstractLdapPool
.- Version:
- $Revision: 1330 $ $Date: 2010-05-24 00:10:53 +0200 (Mon, 24 May 2010) $
- Author:
- Middleware Services
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.vt.middleware.ldap.pool.AbstractLdapPool
AbstractLdapPool.PooledLdap<T extends BaseLdap>
-
-
Field Summary
-
Fields inherited from class edu.vt.middleware.ldap.pool.AbstractLdapPool
active, available, checkInLock, checkOutLock, ldapFactory, logger, poolConfig, poolLock, poolNotEmpty
-
-
Constructor Summary
Constructors Constructor Description SharedLdapPool()
Creates a new ldap pool usingDefaultLdapFactory
.SharedLdapPool(LdapFactory<Ldap> lf)
Creates a new ldap pool with the supplied ldap factory.SharedLdapPool(LdapPoolConfig lpc, LdapFactory<Ldap> lf)
Creates a new ldap pool with the supplied ldap config and factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIn(Ldap l)
Returns an ldap object to the pool.Ldap
checkOut()
Returns an ldap object from the pool.protected Ldap
retrieveAvailable()
This attempts to retrieve an ldap object from the available queue.-
Methods inherited from class edu.vt.middleware.ldap.pool.AbstractLdapPool
activateAndValidate, activeCount, availableCount, close, createActive, createAvailable, createAvailableAndActive, finalize, getLdapPoolConfig, initialize, prune, removeActive, removeAvailable, removeAvailableAndActive, setPoolTimer, validate, validateAndPassivate
-
-
-
-
Constructor Detail
-
SharedLdapPool
public SharedLdapPool()
Creates a new ldap pool usingDefaultLdapFactory
.
-
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 configurationlf
- ldap factory
-
-
Method Detail
-
checkOut
public Ldap checkOut() throws LdapPoolException
Returns an ldap object from the pool.- Returns:
- ldap object
- Throws:
LdapPoolException
- if this operation failsBlockingTimeoutException
- if this pool is configured with a block time and it occursPoolInterruptedException
- if this pool is configured with a block time and the current thread is interrupted
-
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
-
-