|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.ldap.pool.factory.PoolingContextSource
public class PoolingContextSource
A ContextSource implementation that wraps an object pool and another
ContextSource. DirContexts are retrieved from the pool which
maintains them.
Configuration:
| Property | Description | Required | Default |
|---|---|---|---|
| contextSource |
The ContextSource to get DirContexts from for adding to the
pool. |
Yes | null |
| dirContextValidator |
The DirContextValidator to use for validating DirContexts.
Required if any of the test/validate options are enabled. |
No | null |
| minIdle | GenericKeyedObjectPool.setMinIdle(int) |
No | 0 |
| maxIdle | GenericKeyedObjectPool.setMaxIdle(int) |
No | 8 |
| maxActive | GenericKeyedObjectPool.setMaxActive(int) |
No | 8 |
| maxTotal | GenericKeyedObjectPool.setMaxTotal(int) |
No | -1 |
| maxWait | GenericKeyedObjectPool.setMaxWait(long) |
No | -1L |
| whenExhaustedAction | GenericKeyedObjectPool.setWhenExhaustedAction(byte) |
No | GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK |
| testOnBorrow | GenericKeyedObjectPool.setTestOnBorrow(boolean) |
No | false |
| testOnReturn | GenericKeyedObjectPool.setTestOnReturn(boolean) |
No | false |
| testWhileIdle | GenericKeyedObjectPool.setTestWhileIdle(boolean) |
No | false |
| timeBetweenEvictionRunsMillis |
GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis(long) |
No | -1L |
| minEvictableIdleTimeMillis |
GenericKeyedObjectPool.setMinEvictableIdleTimeMillis(long) |
No | 1000L * 60L * 30L |
| numTestsPerEvictionRun |
GenericKeyedObjectPool.setNumTestsPerEvictionRun(int) |
No | 3 |
| Field Summary | |
|---|---|
protected org.apache.commons.pool.impl.GenericKeyedObjectPool |
keyedObjectPool
|
protected org.apache.commons.logging.Log |
logger
The logger for this class and sub-classes |
| Constructor Summary | |
|---|---|
PoolingContextSource()
Creates a new pooling context source, setting up the DirContext object factory and generic keyed object pool. |
|
| Method Summary | |
|---|---|
void |
destroy()
|
protected javax.naming.directory.DirContext |
getContext(DirContextType dirContextType)
Gets a DirContext of the specified type from the keyed object pool. |
javax.naming.directory.DirContext |
getContext(java.lang.String principal,
java.lang.String credentials)
Gets a DirContext instance authenticated using the supplied
principal and credentials. |
ContextSource |
getContextSource()
|
DirContextValidator |
getDirContextValidator()
|
int |
getMaxActive()
|
int |
getMaxIdle()
|
int |
getMaxTotal()
|
long |
getMaxWait()
|
long |
getMinEvictableIdleTimeMillis()
|
int |
getMinIdle()
|
int |
getNumActive()
|
int |
getNumIdle()
|
int |
getNumTestsPerEvictionRun()
|
javax.naming.directory.DirContext |
getReadOnlyContext()
Gets a read-only DirContext. |
javax.naming.directory.DirContext |
getReadWriteContext()
Gets a read-write DirContext instance. |
boolean |
getTestOnBorrow()
|
boolean |
getTestOnReturn()
|
boolean |
getTestWhileIdle()
|
long |
getTimeBetweenEvictionRunsMillis()
|
byte |
getWhenExhaustedAction()
|
void |
setContextSource(ContextSource contextSource)
|
void |
setDirContextValidator(DirContextValidator dirContextValidator)
|
void |
setMaxActive(int maxActive)
|
void |
setMaxIdle(int maxIdle)
|
void |
setMaxTotal(int maxTotal)
|
void |
setMaxWait(long maxWait)
|
void |
setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
|
void |
setMinIdle(int poolSize)
|
void |
setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
|
void |
setTestOnBorrow(boolean testOnBorrow)
|
void |
setTestOnReturn(boolean testOnReturn)
|
void |
setTestWhileIdle(boolean testWhileIdle)
|
void |
setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
|
void |
setWhenExhaustedAction(byte whenExhaustedAction)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
protected final org.apache.commons.pool.impl.GenericKeyedObjectPool keyedObjectPool
| Constructor Detail |
|---|
public PoolingContextSource()
| Method Detail |
|---|
public int getMaxActive()
GenericKeyedObjectPool.getMaxActive()public int getMaxIdle()
GenericKeyedObjectPool.getMaxIdle()public int getMaxTotal()
GenericKeyedObjectPool.getMaxTotal()public long getMaxWait()
GenericKeyedObjectPool.getMaxWait()public long getMinEvictableIdleTimeMillis()
GenericKeyedObjectPool.getMinEvictableIdleTimeMillis()public int getMinIdle()
GenericKeyedObjectPool.getMinIdle()public int getNumActive()
GenericKeyedObjectPool.getNumActive()public int getNumIdle()
GenericKeyedObjectPool.getNumIdle()public int getNumTestsPerEvictionRun()
GenericKeyedObjectPool.getNumTestsPerEvictionRun()public boolean getTestOnBorrow()
GenericKeyedObjectPool.getTestOnBorrow()public boolean getTestOnReturn()
GenericKeyedObjectPool.getTestOnReturn()public boolean getTestWhileIdle()
GenericKeyedObjectPool.getTestWhileIdle()public long getTimeBetweenEvictionRunsMillis()
GenericKeyedObjectPool.getTimeBetweenEvictionRunsMillis()public byte getWhenExhaustedAction()
GenericKeyedObjectPool.getWhenExhaustedAction()public void setMaxActive(int maxActive)
GenericKeyedObjectPool.setMaxActive(int)public void setMaxIdle(int maxIdle)
GenericKeyedObjectPool.setMaxIdle(int)public void setMaxTotal(int maxTotal)
GenericKeyedObjectPool.setMaxTotal(int)public void setMaxWait(long maxWait)
GenericKeyedObjectPool.setMaxWait(long)public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
GenericKeyedObjectPool.setMinEvictableIdleTimeMillis(long)public void setMinIdle(int poolSize)
GenericKeyedObjectPool.setMinIdle(int)public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
GenericKeyedObjectPool.setNumTestsPerEvictionRun(int)public void setTestOnBorrow(boolean testOnBorrow)
GenericKeyedObjectPool.setTestOnBorrow(boolean)public void setTestOnReturn(boolean testOnReturn)
GenericKeyedObjectPool.setTestOnReturn(boolean)public void setTestWhileIdle(boolean testWhileIdle)
GenericKeyedObjectPool.setTestWhileIdle(boolean)public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
GenericKeyedObjectPool.setTimeBetweenEvictionRunsMillis(long)public void setWhenExhaustedAction(byte whenExhaustedAction)
GenericKeyedObjectPool.setWhenExhaustedAction(byte)public ContextSource getContextSource()
public DirContextValidator getDirContextValidator()
public void setContextSource(ContextSource contextSource)
contextSource - the contextSource to set
Requiredpublic void setDirContextValidator(DirContextValidator dirContextValidator)
dirContextValidator - the dirContextValidator to set
Required
public void destroy()
throws java.lang.Exception
destroy in interface org.springframework.beans.factory.DisposableBeanjava.lang.Exception
public javax.naming.directory.DirContext getReadOnlyContext()
throws NamingException
ContextSourceDirContext. The returned
DirContext must be possible to perform read-only operations
on.
getReadOnlyContext in interface ContextSourceNamingException - if some error occurs creating an DirContext.
public javax.naming.directory.DirContext getReadWriteContext()
throws NamingException
ContextSourceDirContext instance.
getReadWriteContext in interface ContextSourceDirContext instance, never null.
NamingException - if some error occurs creating an
DirContext.protected javax.naming.directory.DirContext getContext(DirContextType dirContextType)
dirContextType - The type of context to return.
org.springframework.dao.DataAccessResourceFailureException - If retrieving the object from
the pool throws an exception
public javax.naming.directory.DirContext getContext(java.lang.String principal,
java.lang.String credentials)
throws NamingException
ContextSourceDirContext instance authenticated using the supplied
principal and credentials.
getContext in interface ContextSourceprincipal - The principal (typically a distinguished name of a user
in the LDAP tree) to use for authentication.credentials - The credentials to use for authentication.
DirContext instance, never
null.
NamingException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||