|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.vt.middleware.ldap.pool.AbstractLdapPool<T>
T - type of ldap objectpublic abstract class AbstractLdapPool<T extends BaseLdap>
AbstractLdapPool contains the basic implementation for pooling
ldap objects. The main design objective for the supplied pooling
implementations is to provide a pool that does not block on object creation
or destruction. This is what accounts for the multiple locks available on
this class. The pool is backed by two queues, one for available objects and
one for active objects. Objects that are available for LdapPool.checkOut()
exist in the available queue. Objects that are actively in use exist in the
active queue. Note that depending on the implementation an object can exist
in both queues at the same time.
| Nested Class Summary | |
|---|---|
protected static class |
AbstractLdapPool.PooledLdap<T extends BaseLdap>
PooledLdap contains an ldap object that is participating in a
pool. |
| Field Summary | |
|---|---|
protected Queue<AbstractLdapPool.PooledLdap<T>> |
active
List of ldap objects in use. |
protected Queue<AbstractLdapPool.PooledLdap<T>> |
available
List of available ldap objects in the pool. |
protected ReentrantLock |
checkInLock
Lock for check ins. |
protected ReentrantLock |
checkOutLock
Lock for check outs. |
protected LdapFactory<T> |
ldapFactory
Factory to create ldap objects. |
protected org.apache.commons.logging.Log |
logger
Log for this class. |
protected LdapPoolConfig |
poolConfig
Ldap pool config. |
protected ReentrantLock |
poolLock
Lock for the entire pool. |
protected Condition |
poolNotEmpty
Condition for notifying threads that an object was returned. |
| Constructor Summary | |
|---|---|
AbstractLdapPool(LdapPoolConfig lpc,
LdapFactory<T> lf)
Creates a new pool with the supplied pool configuration and ldap factory. |
|
| Method Summary | |
|---|---|
protected void |
activateAndValidate(T t)
Attempts to activate and validate an ldap object. |
int |
activeCount()
Returns the number of ldap objects in use. |
int |
availableCount()
Returns the number of ldap objects available for use. |
void |
close()
Empty this pool, closing all connections, and freeing any resources. |
protected T |
createActive()
Create a new ldap object and place it in the active pool. |
protected T |
createAvailable()
Create a new ldap object and place it in the available pool. |
protected T |
createAvailableAndActive()
Create a new ldap object and place it in both the available and active pools. |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
LdapPoolConfig |
getLdapPoolConfig()
Returns the configuration for this pool. |
void |
initialize()
Initialize this pool for use. |
void |
prune()
Attempts to reduce the size of the pool back to it's configured minimum. |
protected void |
removeActive(T t)
Remove an ldap object from the active pool. |
protected void |
removeAvailable(T t)
Remove an ldap object from the available pool. |
protected void |
removeAvailableAndActive(T t)
Remove an ldap object from both the available and active pools. |
void |
setPoolTimer(Timer t)
Sets the pool to use an existing timer. |
void |
validate()
Attempts to validate all objects in the pool. |
protected boolean |
validateAndPassivate(T t)
Attempts to validate and passivate an ldap object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface edu.vt.middleware.ldap.pool.LdapPool |
|---|
checkIn, checkOut |
| Field Detail |
|---|
protected final ReentrantLock poolLock
protected final Condition poolNotEmpty
protected final ReentrantLock checkInLock
protected final ReentrantLock checkOutLock
protected final org.apache.commons.logging.Log logger
protected Queue<AbstractLdapPool.PooledLdap<T extends BaseLdap>> available
protected Queue<AbstractLdapPool.PooledLdap<T extends BaseLdap>> active
protected LdapPoolConfig poolConfig
protected LdapFactory<T extends BaseLdap> ldapFactory
| Constructor Detail |
|---|
public AbstractLdapPool(LdapPoolConfig lpc,
LdapFactory<T> lf)
lpc - LdapPoolConfiglf - LdapFactory| Method Detail |
|---|
public LdapPoolConfig getLdapPoolConfig()
getLdapPoolConfig in interface LdapPool<T extends BaseLdap>public void setPoolTimer(Timer t)
LdapPool.initialize().
setPoolTimer in interface LdapPool<T extends BaseLdap>t - timer used to schedule pool taskspublic void initialize()
initialize in interface LdapPool<T extends BaseLdap>public void close()
close in interface LdapPool<T extends BaseLdap>protected T createAvailable()
protected T createActive()
protected T createAvailableAndActive()
protected void removeAvailable(T t)
t - ldap object that exists in the available poolprotected void removeActive(T t)
t - ldap object that exists in the active poolprotected void removeAvailableAndActive(T t)
t - ldap object that exists in the both the available and active
pools
protected void activateAndValidate(T t)
throws LdapPoolException
LdapPool.checkOut().
t - ldap object
LdapPoolException - if this method fais
LdapActivationException - if the ldap object cannot be activated
LdapValidateException - if the ldap object cannot be validatedprotected boolean validateAndPassivate(T t)
LdapPool.checkIn(T).
t - ldap object
public void prune()
LdapPoolConfig.setMinPoolSize(int).
prune in interface LdapPool<T extends BaseLdap>public void validate()
LdapPoolConfig.setValidatePeriodically(boolean).
validate in interface LdapPool<T extends BaseLdap>public int availableCount()
availableCount in interface LdapPool<T extends BaseLdap>public int activeCount()
activeCount in interface LdapPool<T extends BaseLdap>
protected void finalize()
throws Throwable
finalize in class ObjectThrowable - if an exception is thrown by this method
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||