All Packages Class Hierarchy This Package Previous Next Index
Class org.xmlmiddleware.db.StatementPool
java.lang.Object
|
+----org.xmlmiddleware.utils.Pool
|
+----org.xmlmiddleware.db.StatementPool
- public class StatementPool
- extends Pool
- implements SPStatementEventListener
Implements a statement pool.
- Version:
- 2.0
- Author:
- Sean Walter, 2001, Ronald Bourret, 2001
-
StatementPool(Connection)
- Create a new StatementPool.
-
checkIn(Object)
- Check a prepared statement back into the pool.
-
checkOut(Object)
- Check out a prepared statement for the specified SQL string.
-
statementClosed(SPStatementEvent)
- When a SPPreparedStatement is closed, checks the underlying statement back
in to the pool.
-
statementErrorOccurred(SPStatementEvent)
- When an error occurs on a SPPreparedStatement, removes it from the pool.
StatementPool
public StatementPool(Connection conn)
- Create a new StatementPool.
- Parameters:
- conn - Connection to prepare statements from.
checkOut
public Object checkOut(Object sqlString) throws XMLMiddlewareException
- Check out a prepared statement for the specified SQL string.
- Parameters:
- sqlString - The SQL string to use.
- Returns:
- The PreparedStatement.
- Throws: XMLMiddlewareException
- Thrown if the pool does not recognize the string or cannot
return the specified object for any reason, such as lack of resources.
- Overrides:
- checkOut in class Pool
checkIn
public void checkIn(Object pooledStatement) throws XMLMiddlewareException
- Check a prepared statement back into the pool.
- Parameters:
- pooledStatement - The pooled statement.
- Throws: XMLMiddlewareException
- Thrown if the statement does not belong to this pool.
- Overrides:
- checkIn in class Pool
statementClosed
public void statementClosed(SPStatementEvent event)
- When a SPPreparedStatement is closed, checks the underlying statement back
in to the pool.
- Parameters:
- SPStatementEvent - object containing the statement.
statementErrorOccurred
public void statementErrorOccurred(SPStatementEvent event)
- When an error occurs on a SPPreparedStatement, removes it from the pool.
Removing a statement 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 statement or not.
- Parameters:
- SPStatementEvent - object containing the statement.
All Packages Class Hierarchy This Package Previous Next Index