org.ephman.abra.database
Class JDBCDatabaseSessionPool

java.lang.Object
  |
  +--org.ephman.abra.database.JDBCDatabaseSessionPool
All Implemented Interfaces:
DatabaseSessionPool

public class JDBCDatabaseSessionPool
extends java.lang.Object
implements DatabaseSessionPool

Manage a pool of JDBCDatabaseSessions


Constructor Summary
JDBCDatabaseSessionPool(java.lang.String host, java.lang.String database, java.lang.String user, java.lang.String password, int count)
          Create a pool of JDBCSessions.
 
Method Summary
 DatabaseSession get()
          Get an available Database session
static JDBCDatabaseSessionPool getInstance()
           
static JDBCDatabaseSessionPool getInstance(java.lang.String host, java.lang.String database, java.lang.String user, java.lang.String password, int count)
          Retrieve the session pool instance.
 void put(DatabaseSession session)
          Return a session to the pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCDatabaseSessionPool

public JDBCDatabaseSessionPool(java.lang.String host,
                               java.lang.String database,
                               java.lang.String user,
                               java.lang.String password,
                               int count)
                        throws java.sql.SQLException
Create a pool of JDBCSessions.

Parameters:
host - host name for the database server
database - name of the database to which we are connecting
user - user id for database connection
password - password for database connection
count - maximum number of database connections in this pool
Method Detail

getInstance

public static JDBCDatabaseSessionPool getInstance(java.lang.String host,
                                                  java.lang.String database,
                                                  java.lang.String user,
                                                  java.lang.String password,
                                                  int count)
                                           throws java.sql.SQLException
Retrieve the session pool instance.

java.sql.SQLException

getInstance

public static JDBCDatabaseSessionPool getInstance()
                                           throws java.sql.SQLException
java.sql.SQLException

get

public DatabaseSession get()
Get an available Database session

Specified by:
get in interface DatabaseSessionPool
Returns:
database session for use by a thread, null if none are available

put

public void put(DatabaseSession session)
         throws java.lang.Exception
Return a session to the pool

Specified by:
put in interface DatabaseSessionPool
Parameters:
session - session returned to the pool
java.lang.Exception