org.logicalcobwebs.proxool

Class Prototyper


public class Prototyper
extends java.lang.Object

Responsible for prototyping connections for all pools
Version:
$Revision: 1.14 $, $Date: 2006/03/23 11:44:57 $
Authors:
bill
$Author: billhorsman $ (current maintainer)
Since:
Proxool 0.8

Constructor Summary

Prototyper(org.logicalcobwebs.proxool.ConnectionPool connectionPool)

Method Summary

protected ProxyConnection
buildConnection(int status, String creator)
Build a new connection
void
cancel()
Cancel all current prototyping
protected void
checkSimultaneousBuildThrottle()
Checks whether we are currently already building too many connections
protected void
connectionRemoved()
This needs to be called _everytime_ a connection is removed.
String
getAlias()
The alias of the pool we are prototyping for
long
getConnectionCount()
The total number of connections, including those being built right now
protected boolean
isSweepNeeded()
void
quickRefuse()
Give a quick answer to whether we should attempt to build a connection.
protected boolean
sweep()
Trigger prototyping immediately
protected void
triggerSweep()

Constructor Details

Prototyper

public Prototyper(org.logicalcobwebs.proxool.ConnectionPool connectionPool)

Method Details

buildConnection

protected ProxyConnection buildConnection(int status,
                                          String creator)
            throws SQLException,
                   ProxoolException
Build a new connection
Parameters:
status - the initial status it will be created as (this allows us to create it as ACTIVE and avoid another thread grabbing it before we can)
creator - for log audit
Returns:
the new connection

cancel

public void cancel()
Cancel all current prototyping

checkSimultaneousBuildThrottle

protected void checkSimultaneousBuildThrottle()
            throws SQLException
Checks whether we are currently already building too many connections

connectionRemoved

protected void connectionRemoved()
This needs to be called _everytime_ a connection is removed.

getAlias

public String getAlias()
The alias of the pool we are prototyping for
Returns:
alias

getConnectionCount

public long getConnectionCount()
The total number of connections, including those being built right now
Returns:
connectionCount;

isSweepNeeded

protected boolean isSweepNeeded()

quickRefuse

public void quickRefuse()
            throws SQLException
Give a quick answer to whether we should attempt to build a connection. This can be quicker if we are massively overloaded rather than cycling through each connection in the pool to see if it's free

sweep

protected boolean sweep()
Trigger prototyping immediately
Returns:
true if something was prototyped

triggerSweep

protected void triggerSweep()