|
Spring Integration | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.integration.util.SimplePool<T>
public class SimplePool<T>
Implementation of Pool supporting dynamic resizing and a variable
timeout when attempting to obtain an item from the pool. Pool grows on
demand up to the limit.
| Nested Class Summary | |
|---|---|
static interface |
SimplePool.PoolItemCallback<T>
User of the pool provide an implementation of this interface; called during various pool operations. |
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
|---|---|
SimplePool(int poolSize,
SimplePool.PoolItemCallback<T> callback)
Creates a SimplePool with a specific limit. |
|
| Method Summary | |
|---|---|
int |
getActiveCount()
Returns the number of allocated items that are currently checked out of the pool. |
int |
getAllocatedCount()
Returns the current count of allocated items (in use and idle). |
int |
getIdleCount()
Returns the number of items that have been allocated but are not currently in use. |
T |
getItem()
Obtains an item from the pool; waits up to waitTime milliseconds (default infinity). |
int |
getPoolSize()
Returns the current size of the pool; may be greater than the target pool size if it was recently reduced and too many items were in use to allow the new size to be set. |
void |
releaseItem(T item)
Returns an item to the pool. |
void |
removeAllIdleItems()
Removes all idle items from the pool. |
void |
setPoolSize(int poolSize)
Adjusts the current pool size. |
void |
setWaitTimeout(long waitTimeout)
Adjusts the wait timeout - the time for which getItem() will wait if no idle entries are available. |
| 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
| Constructor Detail |
|---|
public SimplePool(int poolSize,
SimplePool.PoolItemCallback<T> callback)
poolSize - The maximum number of items the pool supports.callback - A SimplePool.PoolItemCallback implementation called during various
pool operations.| Method Detail |
|---|
public void setPoolSize(int poolSize)
poolSize - The desired target pool size.public int getPoolSize()
getPoolSize in interface Pool<T>public int getIdleCount()
Pool
getIdleCount in interface Pool<T>public int getActiveCount()
Pool
getActiveCount in interface Pool<T>public int getAllocatedCount()
Pool
getAllocatedCount in interface Pool<T>public void setWaitTimeout(long waitTimeout)
waitTimeout - The wait timeout in milliseconds.public T getItem()
getItem in interface Pool<T>MessagingException - if no items become available in time.public void releaseItem(T item)
releaseItem in interface Pool<T>item - the item.public void removeAllIdleItems()
Pool
removeAllIdleItems in interface Pool<T>
|
Spring Integration | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||