All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.xmlmiddleware.db.ConnectionPool

java.lang.Object
   |
   +----org.xmlmiddleware.utils.Pool
           |
           +----org.xmlmiddleware.db.ConnectionPool

public abstract class ConnectionPool
extends Pool
implements CPConnectionEventListener
Implements a connection pool.

This class is abstract. Classes that need connection pooling extend this class and implement the createObject and removeObject methods from Pool.

Version:
2.0
Author:
Sean Walter, 2001, Ronald Bourret, 2001

Constructor Index

 o ConnectionPool()
Create a new ConnectionPool object.

Method Index

 o checkIn(Object)
Check a connection back into the pool.
 o checkOut(Object)
Check a connection with the specified ID out of the pool.
 o connectionClosed(CPConnectionEvent)
When a CPConnection is closed, checks the underlying connection back in to the pool.
 o connectionErrorOccurred(CPConnectionEvent)
When an error occurs on a CPConnection, removes it from the pool.

Constructors

 o ConnectionPool
 public ConnectionPool()
Create a new ConnectionPool object.

Methods

 o checkOut
 public Object checkOut(Object id) throws XMLMiddlewareException
Check a connection with the specified ID out of the pool.

Overrides Pool.checkOut(Object).

Returns:
The object.
Throws: XMLMiddlewareException
Thrown if the pool does not recognize the ID or cannot return the specified object for any reason, such as lack of resources.
Overrides:
checkOut in class Pool
 o checkIn
 public void checkIn(Object object) throws XMLMiddlewareException
Check a connection back into the pool.

Overrides Pool.checkIn(Object).

Parameters:
object - The object.
Throws: XMLMiddlewareException
Thrown if the object does not belong to this pool.
Overrides:
checkIn in class Pool
 o connectionClosed
 public void connectionClosed(CPConnectionEvent event)
When a CPConnection is closed, checks the underlying connection back in to the pool.

Parameters:
CPConnectionEvent - object containing the connection.
 o connectionErrorOccurred
 public void connectionErrorOccurred(CPConnectionEvent event)
When an error occurs on a CPConnection, removes it from the pool.

Removing a connection from the pool in the case of an error is admittedly drastic, but there is no way to tell if the error was fatal to the connection or not.

Parameters:
CPConnectionEvent - object containing the connection.

All Packages  Class Hierarchy  This Package  Previous  Next  Index