|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.logicalcobwebs.proxool.Prototyper
public class Prototyper
Responsible for prototyping connections for all pools
Field Summary | |
---|---|
private boolean |
cancel
Calling cancel will set this to true and stop all
current prototyping immediately |
private ConnectionBuilderIF |
connectionBuilder
The builder that will create *real* connections for us. |
private long |
connectionCount
|
private ConnectionPool |
connectionPool
|
private int |
connectionsBeingMade
The number of connections currently being made (actually in progress) |
private java.lang.Object |
lock
|
private Log |
log
|
private long |
nextConnectionId
This allows us to have a unique ID for each connection |
private boolean |
sweepNeeded
|
Constructor Summary | |
---|---|
Prototyper(ConnectionPool connectionPool)
|
Method Summary | |
---|---|
protected ProxyConnection |
buildConnection(int status,
java.lang.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. |
java.lang.String |
getAlias()
The alias of the pool we are prototyping for |
long |
getConnectionCount()
The total number of connections, including those being built right now |
private ConnectionPoolDefinitionIF |
getDefinition()
Utility method |
protected boolean |
isSweepNeeded()
|
boolean |
quickRefuse()
Give a quick answer to whether we should attempt to build a connection. |
protected boolean |
sweep()
Trigger prototyping immediately |
protected void |
triggerSweep()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private ConnectionPool connectionPool
private Log log
private long connectionCount
private final java.lang.Object lock
private boolean sweepNeeded
private long nextConnectionId
private boolean cancel
cancel
will set this to true and stop all
current prototyping immediately
private int connectionsBeingMade
private ConnectionBuilderIF connectionBuilder
Constructor Detail |
---|
public Prototyper(ConnectionPool connectionPool)
Method Detail |
---|
protected boolean isSweepNeeded()
protected void triggerSweep()
protected boolean sweep()
protected ProxyConnection buildConnection(int status, java.lang.String creator) throws java.sql.SQLException, ProxoolException
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
java.sql.SQLException
ProxoolException
protected void connectionRemoved()
protected void checkSimultaneousBuildThrottle() throws java.sql.SQLException
java.sql.SQLException
- if the throttle has been reachedpublic long getConnectionCount()
private ConnectionPoolDefinitionIF getDefinition()
public void cancel()
public java.lang.String getAlias()
public boolean quickRefuse()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |