Enhydra 5.1 API

com.lutris.appserver.server.sql
Interface ConnectionAllocator

All Known Implementing Classes:
StandardConnectionAllocator

public interface ConnectionAllocator

Defines the connection allocator. A connection allocator is an integral part of a logical database implementation. It manages a pool of database connections.

Since:
LBS1.8
Version:
$Revision: 1.2 $
Author:
Paul Morgan

Method Summary
 DBConnection allocate()
          Allocate a connection either from the managed pool or create a new.
 void drop(DBConnection dbConnection)
          Used to drop a connection from the pool.
 void dropAllNow()
          Drop all the connection in the pool immediately.
 int getActiveCount()
          Return the number of currently active (allocated) connections.
 int getMaxCount()
          Return the maximum number of connections active at one time.
 java.util.Date getMaxCountDate()
          Return the time when the maximum connection count occured.
 long getRequestCount()
          Return the number of database requests made on any of the connection allocated from this managed pool.
 void release(DBConnection dbConnection)
          Return a connection to the pool.
 void resetMaxCount()
          Reset the maximum connection count and date.
 

Method Detail

allocate

public DBConnection allocate()
                      throws java.sql.SQLException
Allocate a connection either from the managed pool or create a new.

Throws:
java.sql.SQLException - if a SQL error occures.

release

public void release(DBConnection dbConnection)
Return a connection to the pool. If it is of an old generation, close and drop.

Parameters:
dbConnection - The connection object to return.

drop

public void drop(DBConnection dbConnection)
Used to drop a connection from the pool. The connection should not be re-allocated

Parameters:
dbConnection - The connection object to drop.

dropAllNow

public void dropAllNow()
Drop all the connection in the pool immediately.


getActiveCount

public int getActiveCount()
Return the number of currently active (allocated) connections.

Returns:
The number of connections.

getMaxCount

public int getMaxCount()
Return the maximum number of connections active at one time.

Returns:
The number of connections.

getMaxCountDate

public java.util.Date getMaxCountDate()
Return the time when the maximum connection count occured.

Returns:
The Date when the maximum connection count occured.

resetMaxCount

public void resetMaxCount()
Reset the maximum connection count and date.


getRequestCount

public long getRequestCount()
Return the number of database requests made on any of the connection allocated from this managed pool. Implementations of the connection allocator must provide a mechanism for DBQuery and DBTransaction objects to count requests.

Returns:
The number of database requests (queries or transactions).

Enhydra 5.1 API