coreservlets
Class ConnectionPool
java.lang.Object
|
+--coreservlets.ConnectionPool
- public class ConnectionPool
- extends Object
- implements Runnable
A class for preallocating, recycling, and managing
JDBC connections.
Taken from Core Servlets and JavaServer Pages
from Prentice Hall and Sun Microsystems Press,
http://www.coreservlets.com/.
© 2000 Marty Hall; may be freely used or adapted.
ConnectionPool
public ConnectionPool(String driver,
String url,
String username,
String password,
int initialConnections,
int maxConnections,
boolean waitIfBusy)
throws SQLException
getConnection
public Connection getConnection()
throws SQLException
run
public void run()
- Specified by:
- run in interface Runnable
free
public void free(Connection connection)
totalConnections
public int totalConnections()
closeAllConnections
public void closeAllConnections()
- Close all the connections. Use with caution:
be sure no connections are in use before
calling. Note that you are not required to
call this when done with a ConnectionPool, since
connections are guaranteed to be closed when
garbage collected. But this method gives more control
regarding when the connections are closed.
toString
public String toString()
- Overrides:
- toString in class Object
 |
|---|
| CSAJSP @ amazon.com |
|---|