public interface IlrPool<T>
IlrPool represents a pool of objects.
Use implementations of this interface to pool resource adapter (JCA) connections.
The properties of a pool implementation are specified in
ra.xml.
An pool object can have the following states:
used - the object has been added by calling add(T)
and must not be returned by getFreeObjects() until release(T)
is called.free - the object can be returned by calling
getFreeObjects().An object is removed from the pool:
remove(T) is called.IlrPoolListeners must be notified.Implementations of this interface must be thread-safe.
After the instance is created, setLogger(java.util.logging.Logger) then
initialize(Map) is called.
| Modifier and Type | Method and Description |
|---|---|
void |
add(T object)
Adds a free object to this pool.
|
void |
addPoolEventListener(IlrPoolListener<T> listener)
Adds a listener.
|
java.util.Set<T> |
getFreeObjects()
Returns all the free objects in this pool.
|
void |
initialize(java.util.Map<java.lang.String,java.lang.String> properties)
Initializes this pool with a given set of properties.
|
boolean |
isFull()
Checks if the pool is full.
|
void |
release(T object)
Notifies the pool that an object is no longer used.
|
boolean |
remove(T object)
Removes an object from this pool.
|
void |
removePoolEventListener(IlrPoolListener<T> listener)
Removes a listener.
|
void |
setLogger(java.util.logging.Logger logger)
Sets the logger to be used by the pool implementation.
|
void |
use(T object)
Notifies the pool that an object is used.
|
void |
waitNotFull()
Waits until the pool is not full.
|
void initialize(java.util.Map<java.lang.String,java.lang.String> properties)
properties - A set of configuration properties.void add(T object)
object - A free object.boolean remove(T object)
getFreeObjects().object - The object to remove.java.util.Set<T> getFreeObjects()
void use(T object)
object - The object used.void release(T object)
object - The object to release.boolean isFull()
true is returned.void waitNotFull()
throws IlrPoolException,
java.lang.UnsupportedOperationException
IlrPoolException - indicates that it is not
possible to wait. The reason depends on the pool implementation.
For example, the maximum number of waiters or the timeout has been
reached.java.lang.UnsupportedOperationException - indicates
that this method is not supported by the implementation.void setLogger(java.util.logging.Logger logger)
logger - The logger to be used by the pool implementation.void addPoolEventListener(IlrPoolListener<T> listener)
listener - A pool event listener.void removePoolEventListener(IlrPoolListener<T> listener)
listener - The pool event listener to remove.© Copyright IBM Corp. 1987, 2017