EAF 7.6 API

com.lutris.appserver.server.sql
Interface ConnectionAllocator


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.1 $
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.
 java.lang.String getDatabaseName()
           
 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

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

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

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

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


getActiveCount

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

Returns:
The number of connections.

getMaxCount

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

Returns:
The number of connections.

getMaxCountDate

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

Returns:
The Date when the maximum connection count occured.

resetMaxCount

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


getRequestCount

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).

getDatabaseName

java.lang.String getDatabaseName()
Returns:
database name of current connection

EAF 7.6 API