|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ldaptive.pool.AbstractPool<Connection>
org.ldaptive.pool.AbstractConnectionPool
org.ldaptive.pool.BlockingConnectionPool
public class BlockingConnectionPool
Implements a pool of connections 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 connections 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
connections that can be created. See AbstractConnectionPool.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.ldaptive.pool.AbstractConnectionPool |
|---|
AbstractConnectionPool.DefaultPooledConnectionProxy |
| Field Summary |
|---|
| Fields inherited from class org.ldaptive.pool.AbstractConnectionPool |
|---|
active, available, checkInLock, checkOutLock, poolLock, poolNotEmpty |
| Fields inherited from class org.ldaptive.pool.AbstractPool |
|---|
logger |
| Constructor Summary | |
|---|---|
BlockingConnectionPool()
Creates a new blocking pool. |
|
BlockingConnectionPool(DefaultConnectionFactory cf)
Creates a new blocking pool. |
|
BlockingConnectionPool(PoolConfig pc,
DefaultConnectionFactory cf)
Creates a new blocking pool. |
|
| Method Summary | |
|---|---|
protected PooledConnectionProxy |
blockAvailableConnection()
This blocks until a connection can be acquired. |
long |
getBlockWaitTime()
Returns the block wait time. |
Connection |
getConnection()
Returns a connection from the pool. |
void |
putConnection(Connection c)
Returns a connection to the pool. |
protected PooledConnectionProxy |
retrieveAvailableConnection()
Attempts to retrieve a connection from the available queue. |
void |
setBlockWaitTime(long time)
Sets the block wait time. |
| Methods inherited from class org.ldaptive.pool.AbstractPool |
|---|
activate, getActivator, getName, getPassivator, getPoolConfig, getPruneStrategy, getValidator, passivate, setActivator, setName, setPassivator, setPoolConfig, setPruneStrategy, setValidator, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.ldaptive.pool.ConnectionPool |
|---|
getActivator, getPassivator, getValidator, setActivator, setPassivator, setValidator |
| Constructor Detail |
|---|
public BlockingConnectionPool()
public BlockingConnectionPool(DefaultConnectionFactory cf)
cf - connection factory
public BlockingConnectionPool(PoolConfig pc,
DefaultConnectionFactory cf)
pc - pool configurationcf - connection factory| Method Detail |
|---|
public long getBlockWaitTime()
public void setBlockWaitTime(long time)
time - in milliseconds to wait for available connections
public Connection getConnection()
throws PoolException
getConnection in interface ConnectionPoolgetConnection in class AbstractConnectionPoolPoolException - if this operation fails
BlockingTimeoutException - if this pool is configured with a block
time and it occurs
PoolInterruptedException - if this pool is configured with a block
time and the current thread is interruptedprotected PooledConnectionProxy retrieveAvailableConnection()
NoSuchElementException - if the available queue is empty
protected PooledConnectionProxy blockAvailableConnection()
throws PoolException
PoolException - if this method fails
BlockingTimeoutException - if this pool is configured with a block
time and it occurs
PoolInterruptedException - if the current thread is interruptedpublic void putConnection(Connection c)
putConnection in class AbstractConnectionPoolc - connection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||