org.logicalcobwebs.proxool
类 Prototyper

java.lang.Object
  继承者 org.logicalcobwebs.proxool.Prototyper

public class Prototyper
extends Object

Responsible for prototyping connections for all pools

从以下版本开始:
Proxool 0.8
版本:
$Revision: 1.14 $, $Date: 2006/03/23 11:44:57 $
作者:
bill, $Author: billhorsman $ (current maintainer)

构造方法摘要
Prototyper(org.logicalcobwebs.proxool.ConnectionPool connectionPool)
           
 
方法摘要
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()
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

Prototyper

public Prototyper(org.logicalcobwebs.proxool.ConnectionPool connectionPool)
方法详细信息

isSweepNeeded

protected boolean isSweepNeeded()

triggerSweep

protected void triggerSweep()

sweep

protected boolean sweep()
Trigger prototyping immediately

返回:
true if something was prototyped

buildConnection

protected ProxyConnection buildConnection(int status,
                                          String creator)
                                   throws SQLException,
                                          ProxoolException
Build a new connection

参数:
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
返回:
the new connection
抛出:
SQLException
ProxoolException

connectionRemoved

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


checkSimultaneousBuildThrottle

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

抛出:
SQLException - if the throttle has been reached

getConnectionCount

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

返回:
connectionCount;

cancel

public void cancel()
Cancel all current prototyping


getAlias

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

返回:
alias

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

抛出:
SQLException - if it is a waste of time even trying to get a connaction. Just because this method doesn't throw an exception it doesn't guarantee that one will be available. There is a slight risk that we might tell the client to give up when a connection could become available in the next few milliseconds but our policy is to refuse connections quickly when overloaded.


Copyright © 2014. All rights reserved.