Spring Integration

org.springframework.integration.util
Interface SimplePool.PoolItemCallback<T>

Enclosing class:
SimplePool<T>

public static interface SimplePool.PoolItemCallback<T>

User of the pool provide an implementation of this interface; called during various pool operations.


Method Summary
 T createForPool()
          Called by the pool when a new instance is required to populate the pool.
 boolean isStale(T item)
          Called by the pool when an idle item is retrieved from the pool.
 void removedFromPool(T item)
          Called by the pool when an item is forcibly removed from the pool - for example when the pool size is reduced.
 

Method Detail

createForPool

T createForPool()
Called by the pool when a new instance is required to populate the pool. Only called if no idle non-stale instances are available.

Returns:
The item.

isStale

boolean isStale(T item)
Called by the pool when an idle item is retrieved from the pool. Indicates whether that item is usable, or should be discarded. The pool takes no further action on a stale item, discards it, and attempts to find or create another item.

Parameters:
item - The item.
Returns:
true if the item should not be used.

removedFromPool

void removedFromPool(T item)
Called by the pool when an item is forcibly removed from the pool - for example when the pool size is reduced. The implementation should perform any cleanup necessary on the item, such as closing connections etc.

Parameters:
item - The item.

Spring Integration