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
.AbstractLdapPool.PooledLdap<T extends BaseLdap>
active, available, checkInLock, checkOutLock, ldapFactory, logger, poolConfig, poolLock, poolNotEmpty
Constructor and Description |
---|
SharedLdapPool()
Creates a new ldap pool using
DefaultLdapFactory . |
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.
|
Modifier and Type | Method and 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.
|
activateAndValidate, activeCount, availableCount, close, createActive, createAvailable, createAvailableAndActive, finalize, getLdapPoolConfig, initialize, prune, removeActive, removeAvailable, removeAvailableAndActive, setPoolTimer, validate, validateAndPassivate
public SharedLdapPool()
DefaultLdapFactory
.public SharedLdapPool(LdapFactory<Ldap> lf)
lf
- ldap factorypublic SharedLdapPool(LdapPoolConfig lpc, LdapFactory<Ldap> lf)
lpc
- ldap pool configurationlf
- ldap factorypublic Ldap checkOut() throws LdapPoolException
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 interruptedprotected Ldap retrieveAvailable()
IllegalStateException
- if an object cannot be removed from the
available queuepublic void checkIn(Ldap l)
l
- ldap objectCopyright © 2019. All rights reserved.