com.xmlserv.util
Interface ConnectionPool

All Known Implementing Classes:
PGConnectionPool

public interface ConnectionPool

A simple connection pool interface.

Version:
$Id: ConnectionPool.java,v 1.5 2002/04/16 12:33:05 muecke Exp $
Author:
Wolfram Saringer.

Method Summary
 java.sql.Connection checkoutConn()
          Get a connection from the pool.
 void destroy()
          Destroy pool, releasing all DB connections.
 void init(java.lang.String url, java.lang.String username, java.lang.String password, int poolSize)
          Initialize with the given connection URL (DB specific), username, password ans pool size.
 void returnConn(java.sql.Connection conn)
          Return a connection to the pool.
 

Method Detail

init

public void init(java.lang.String url,
                 java.lang.String username,
                 java.lang.String password,
                 int poolSize)
          throws java.sql.SQLException
Initialize with the given connection URL (DB specific), username, password ans pool size.
Parameters:
url - DB specific connection URL.
username - The username for DB authentication.
password - The password for DB authentication.
poolSize - The initial pool size.
Throws:
java.sql.SQLException - When the DB connection fails.

destroy

public void destroy()
Destroy pool, releasing all DB connections.

checkoutConn

public java.sql.Connection checkoutConn()
                                 throws java.sql.SQLException
Get a connection from the pool.
Returns:
A Connection object with autoCommit set to false.
Throws:
java.sql.SQLException - In case the pool is exhausted and cannot be grown.

returnConn

public void returnConn(java.sql.Connection conn)
                throws java.sql.SQLException
Return a connection to the pool.
Parameters:
conn - The Connection to return. The autoCommit property will be reset to false.
Throws:
java.sql.SQLException - Any DB related error.