org.alicebot.server.sql.pool
Class DbAccessRefsPoolMgr

java.lang.Object
  extended by org.alicebot.server.sql.pool.ObjectPool
      extended by org.alicebot.server.sql.pool.DbAccessRefsPoolMgr

public class DbAccessRefsPoolMgr
extends ObjectPool

Manages a pool of references to a database.

Author:
Cristian Mircioiu

Field Summary
protected  java.lang.String driver
          The name of the driver used by this object.
protected  java.lang.String password
          The password used by this object.
protected  java.lang.String url
          The URL string used by this object.
protected  java.lang.String user
          The user name used by this object.
 
Constructor Summary
DbAccessRefsPoolMgr(java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password)
          Constructs a DbAccessRefsPoolMgr object given a driver, url, user name and password.
 
Method Summary
protected  java.lang.Object create()
          Initializes the object by attempting to get a DbAccess object based on the parameters set.
protected  void expire(java.lang.Object o)
          Expires an object in the pool.
 void populate(int connectionCount)
          Builds a pool of the specified number of connections.
 void returnDbaRef(DbAccess dba)
          Checks back in and locks a DbAccess reference to the database.
 DbAccess takeDbaRef()
          Checks out and unlocks a DbAccess reference to the database.
protected  boolean validate(java.lang.Object o)
          Validates an object in the pool.
 
Methods inherited from class org.alicebot.server.sql.pool.ObjectPool
checkIn, checkOut, cleanUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

driver

protected java.lang.String driver
The name of the driver used by this object.


url

protected java.lang.String url
The URL string used by this object.


user

protected java.lang.String user
The user name used by this object.


password

protected java.lang.String password
The password used by this object.

Constructor Detail

DbAccessRefsPoolMgr

public DbAccessRefsPoolMgr(java.lang.String driver,
                           java.lang.String url,
                           java.lang.String user,
                           java.lang.String password)
Constructs a DbAccessRefsPoolMgr object given a driver, url, user name and password.

Parameters:
driver - name of the class representing the Driver to be used by the Driver manager
url - location of a data source name (dsn)
user - user name
password - password for user
Method Detail

create

protected java.lang.Object create()
Initializes the object by attempting to get a DbAccess object based on the parameters set.

Specified by:
create in class ObjectPool

populate

public void populate(int connectionCount)
Builds a pool of the specified number of connections.

Parameters:
connectionCount - the number of connections to create

returnDbaRef

public void returnDbaRef(DbAccess dba)
Checks back in and locks a DbAccess reference to the database.

Parameters:
dba - the reference to return

takeDbaRef

public DbAccess takeDbaRef()
Checks out and unlocks a DbAccess reference to the database.

Returns:
a reference to the database

validate

protected boolean validate(java.lang.Object o)
Description copied from class: ObjectPool
Validates an object in the pool.

Specified by:
validate in class ObjectPool
Parameters:
o - the object to validate

expire

protected void expire(java.lang.Object o)
Description copied from class: ObjectPool
Expires an object in the pool.

Specified by:
expire in class ObjectPool