org.logicalcobwebs.proxool
Class ConnectionPoolDefinition

java.lang.Object
  extended by org.logicalcobwebs.proxool.ConnectionPoolDefinition
All Implemented Interfaces:
ConnectionPoolDefinitionIF

 class ConnectionPoolDefinition
extends java.lang.Object
implements ConnectionPoolDefinitionIF

This defines a connection pool: the URL to connect to the database, the delegate driver to use, and how the pool behaves.

Version:
$Revision: 1.33 $, $Date: 2005/05/04 16:24:59 $
Author:
billhorsman, $Author: billhorsman $ (current maintainer)

Field Summary
private  java.lang.String alias
           
private  java.util.Properties changedInfo
           
private  java.util.Properties completeInfo
           
private  java.lang.String completeUrl
           
private  boolean connectionPropertiesChanged
          Whether any of the properties that effect an individual connection have changed.
private  java.util.Properties delegateProperties
           
private  java.lang.String driver
           
private  java.util.Set fatalSqlExceptions
           
private  java.lang.String fatalSqlExceptionsAsString
          A String of all the fatalSqlExceptions delimited by ConnectionPoolDefinitionIF.FATAL_SQL_EXCEPTIONS_DELIMITER
private  java.lang.String fatalSqlExceptionWrapper
           
private  int houseKeepingSleepTime
           
private  java.lang.String houseKeepingTestSql
           
private  java.lang.String initialContextFactory
           
private  java.lang.Class injectableCallableStatementInterface
           
private  java.lang.Class injectableConnectionInterface
           
private  java.lang.Class injectablePreparedStatementInterface
           
private  java.lang.Class injectableStatementInterface
           
private  boolean jmx
           
private  java.lang.String jmxAgentId
           
private  java.lang.String jndiName
           
private static Log LOG
           
private  int maximumActiveTime
           
private  int maximumConnectionCount
           
private  int maximumConnectionLifetime
           
private  int minimumConnectionCount
           
private  int overloadWithoutRefusalLifetime
           
private  Log poolLog
          This log has a category based on the alias
private  int prototypeCount
           
private  java.lang.String providerUrl
           
private  int recentlyStartedThreshold
           
private  java.lang.String securityAuthentication
           
private  java.lang.String securityCredentials
           
private  java.lang.String securityPrincipal
           
private  int simultaneousBuildThrottle
           
private  java.lang.String statistics
           
private  java.lang.String statisticsLogLevel
           
private  boolean testAfterUse
           
private  boolean testBeforeUse
           
private  boolean trace
           
private  java.lang.String url
           
private  boolean verbose
           
 
Fields inherited from interface org.logicalcobwebs.proxool.ConnectionPoolDefinitionIF
DEBUG_LEVEL_LOUD, DEBUG_LEVEL_QUIET, DEFAULT_HOUSE_KEEPING_SLEEP_TIME, DEFAULT_MAXIMUM_ACTIVE_TIME, DEFAULT_MAXIMUM_CONNECTION_COUNT, DEFAULT_MAXIMUM_CONNECTION_LIFETIME, DEFAULT_MAXIMUM_NEW_CONNECTIONS, DEFAULT_MINIMUM_CONNECTION_COUNT, DEFAULT_OVERLOAD_WITHOUT_REFUSAL_THRESHOLD, DEFAULT_PROTOTYPE_COUNT, DEFAULT_RECENTLY_STARTED_THRESHOLD, DEFAULT_SIMULTANEOUS_BUILD_THROTTLE, FATAL_SQL_EXCEPTIONS_DELIMITER, PASSWORD_PROPERTY, USER_PROPERTY
 
Constructor Summary
  ConnectionPoolDefinition()
          So we can set the values one by one if we want
protected ConnectionPoolDefinition(java.lang.String url, java.util.Properties info, boolean explicitRegister)
          Construct a new definition
 
Method Summary
private  void clearChangedInfo()
           
protected  java.lang.Object clone()
          Deep clone of definition
private  boolean doChange(java.lang.String url, java.util.Properties info, boolean pretend, boolean implicitRegister)
           
 java.lang.String getAlias()
          The name associated with this connection pool.
protected  java.util.Properties getCompleteInfo()
          Get all the properties used to define this pool
 java.lang.String getCompleteUrl()
          The URL that was used to define this pool.
 int getDebugLevel()
          Deprecated. use isVerbose() instead
 java.util.Properties getDelegateProperties()
          Get all of the properties that are defined on the delegated driver.
 java.lang.String getDelegateProperty(java.lang.String name)
          Get a property
 java.lang.String getDriver()
           
 java.util.Set getFatalSqlExceptions()
          Get the list of fatal SQL exception (Strings) fragments that will trigger the death of a Connection.
 java.lang.String getFatalSqlExceptionWrapper()
          If this is not-null then any fatal SQLException is wrapped up inside an instance of this class.
 int getHouseKeepingSleepTime()
          This is the time the house keeping thread sleeps for between checks.
 java.lang.String getHouseKeepingTestSql()
          The test SQL that we perform to see if a connection is alright.
 java.lang.String getInitialContextFactory()
          JNDI property
 java.lang.String getInjectableCallableStatememtInterfaceName()
           
 java.lang.Class getInjectableCallableStatementInterface()
          The class name of an interface that should be injected everytime we make a CallableStatement.
 java.lang.Class getInjectableConnectionInterface()
          The class name of an interface that should be injected everytime we make a Connection.
 java.lang.String getInjectableConnectionInterfaceName()
           
 java.lang.Class getInjectablePreparedStatementInterface()
          The class name of an interface that should be injected everytime we make a PreparedStatement.
 java.lang.String getInjectablePreparedStatementInterfaceName()
           
 java.lang.Class getInjectableStatementInterface()
          The class name of an interface that should be injected everytime we make a Statement.
 java.lang.String getInjectableStatementInterfaceName()
           
private  int getInt(java.lang.String key, java.lang.String value)
           
private  java.lang.Class getInterface(java.lang.String className)
           
 java.lang.String getJdbcDriverVersion()
           
 java.lang.String getJmxAgentId()
          Get a comma separated list of JMX agent ids (as used by MBeanServerFactory.findMBeanServer(String agentId)) to register the pool to.
 java.lang.String getJndiName()
          JNDI property
 int getMaximumActiveTime()
          If the housekeeper comes across a thread that has been active for longer than this then it will kill it.
 int getMaximumConnectionCount()
          The maximum number of connections to the database
 int getMaximumConnectionLifetime()
          The maximum amount of time that a connection exists for before it is killed (recycled).
 int getMaximumNewConnections()
          Deprecated. use more descriptive getSimultaneousBuildThrottle() instead
 int getMinimumConnectionCount()
          The minimum number of connections we will keep open, regardless of whether anyone needs them or not.
 java.lang.String getName()
          Deprecated. use getAlias()
 int getOverloadWithoutRefusalLifetime()
          This is the time in milliseconds after the last time that we refused a connection that we still consider ourselves to be overloaded.
 java.lang.String getPassword()
          The password to use to login to the database
 java.util.Properties getProperties()
          Deprecated. use less ambiguous getDelegateProperties() instead
 int getPrototypeCount()
          This is the number of spare connections we will strive to have.
 java.lang.String getProviderUrl()
          JNDI property
 int getRecentlyStartedThreshold()
          As long as we have one connection that was started within this threshold then we consider the pool to be up.
 java.lang.String getSecurityAuthentication()
          JNDI property
 java.lang.String getSecurityCredentials()
          JNDI property
 java.lang.String getSecurityPrincipal()
          JNDI property
 int getSimultaneousBuildThrottle()
          In order to prevent overloading, this is the maximum number of connections that you can have that are in the progress of being made.
 java.lang.String getStatistics()
          The sample length (in seconds) when taking statistical information, or null to disable statistics.
 java.lang.String getStatisticsLogLevel()
          Whether statistics are logged as they are produced.
 java.lang.String getUrl()
          This is the URL used to connect to the database.
 java.lang.String getUser()
           
private static boolean isChanged(java.lang.String oldValue, java.lang.String newValue)
           
 boolean isEqual(java.lang.String url, java.util.Properties info)
          Returns true if redefining the pool using these parameters would not change the definition.
 boolean isJmx()
          Indicate wether this pool should be registered with JMX or not.
 boolean isTestAfterUse()
          Whether we test each connection after it is closed (that is, returned to the pool)
 boolean isTestBeforeUse()
          Whether we test each connection before it is served
 boolean isTrace()
          if this is true then we will log each execution.
 boolean isVerbose()
          If this is true then we start logging a lot of stuff everytime we serve a connection and everytime the house keeper and prototyper run.
private  void logChange(boolean proxoolProperty, java.lang.String key, java.lang.String value)
           
protected  void redefine(java.lang.String url, java.util.Properties info)
          Redefine the definition.
private  void reset()
          Reset all properties to their default values
 void setAlias(java.lang.String alias)
           
private  boolean setAnyProperty(java.lang.String key, java.lang.String value, boolean pretend)
           
 void setCompleteInfo(java.util.Properties completeInfo)
          Overwrite the complete info
 void setCompleteUrl(java.lang.String completeUrl)
           
 void setDelegateProperties(java.util.Properties delegateProperties)
          Overwrite the delegate properties
 void setDelegateProperty(java.lang.String name, java.lang.String value)
          Set a property
 void setDriver(java.lang.String driver)
           
 void setFatalSqlExceptionsAsString(java.lang.String fatalSqlExceptionsAsString)
           
 void setFatalSqlExceptionWrapper(java.lang.String fatalSqlExceptionWrapper)
           
private  boolean setHouseKeeperProperty(java.lang.String key, java.lang.String value, boolean pretend)
          Subset of setAnyProperty(java.lang.String, java.lang.String, boolean) to avoid overly long method.
 void setHouseKeepingSleepTime(int houseKeepingSleepTime)
           
 void setHouseKeepingTestSql(java.lang.String houseKeepingTestSql)
           
 void setInitialContextFactory(java.lang.String initialContextFactory)
           
 void setInjectableCallableStatementInterfaceName(java.lang.String injectableCallableStatementInterfaceName)
           
 void setInjectableConnectionInterfaceName(java.lang.String injectableConnectionInterfaceName)
           
 void setInjectablePreparedStatementInterfaceName(java.lang.String injectablePreparedStatementInterfaceName)
           
private  boolean setInjectableProperty(java.lang.String key, java.lang.String value, boolean pretend)
          Subset of setAnyProperty(java.lang.String, java.lang.String, boolean) to avoid overly long method
 void setInjectableStatementInterfaceName(java.lang.String injectableStatementInterfaceName)
           
 void setJmx(boolean jmx)
           
 void setJmxAgentId(java.lang.String jmxAgentId)
           
 void setJndiName(java.lang.String jndiName)
           
private  boolean setJndiProperty(java.lang.String key, java.lang.String value, boolean pretend)
          Subset of setAnyProperty(java.lang.String, java.lang.String, boolean) to avoid overly long method
private  boolean setLoggingProperty(java.lang.String key, java.lang.String value, boolean pretend)
          Subset of setAnyProperty(java.lang.String, java.lang.String, boolean) to avoid overly long method
 void setMaximumActiveTime(int maximumActiveTime)
           
 void setMaximumConnectionCount(int maximumConnectionCount)
           
 void setMaximumConnectionLifetime(int maximumConnectionLifetime)
           
 void setMaximumNewConnections(int maximumNewConnections)
          Deprecated. use more descriptive setSimultaneousBuildThrottle(int) instead
 void setMinimumConnectionCount(int minimumConnectionCount)
           
 void setOverloadWithoutRefusalLifetime(int overloadWithoutRefusalLifetime)
           
 void setPassword(java.lang.String password)
           
 void setPrototypeCount(int prototypeCount)
           
 void setProviderUrl(java.lang.String providerUrl)
           
 void setRecentlyStartedThreshold(int recentlyStartedThreshold)
           
 void setSecurityAuthentication(java.lang.String securityAuthentication)
           
 void setSecurityCredentials(java.lang.String securityCredentials)
           
 void setSecurityPrincipal(java.lang.String securityPrincipal)
           
 void setSimultaneousBuildThrottle(int simultaneousBuildThrottle)
           
 void setStatistics(java.lang.String statistics)
           
 void setStatisticsLogLevel(java.lang.String statisticsLogLevel)
           
 void setTestAfterUse(boolean testAfterUse)
           
 void setTestBeforeUse(boolean testBeforeUse)
           
 void setTrace(boolean trace)
           
 void setUrl(java.lang.String url)
           
 void setUser(java.lang.String user)
           
 void setVerbose(boolean verbose)
           
 java.lang.String toString()
           
protected  void update(java.lang.String url, java.util.Properties info)
          Update the definition.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final Log LOG

poolLog

private Log poolLog
This log has a category based on the alias


alias

private java.lang.String alias

jndiName

private java.lang.String jndiName

initialContextFactory

private java.lang.String initialContextFactory

providerUrl

private java.lang.String providerUrl

securityAuthentication

private java.lang.String securityAuthentication

securityPrincipal

private java.lang.String securityPrincipal

securityCredentials

private java.lang.String securityCredentials

delegateProperties

private java.util.Properties delegateProperties

completeInfo

private java.util.Properties completeInfo

changedInfo

private java.util.Properties changedInfo

connectionPropertiesChanged

private boolean connectionPropertiesChanged
Whether any of the properties that effect an individual connection have changed. If they have, we need to kill all the existing connections.


url

private java.lang.String url

completeUrl

private java.lang.String completeUrl

driver

private java.lang.String driver

maximumConnectionLifetime

private int maximumConnectionLifetime

prototypeCount

private int prototypeCount

minimumConnectionCount

private int minimumConnectionCount

maximumConnectionCount

private int maximumConnectionCount

houseKeepingSleepTime

private int houseKeepingSleepTime

simultaneousBuildThrottle

private int simultaneousBuildThrottle

recentlyStartedThreshold

private int recentlyStartedThreshold

overloadWithoutRefusalLifetime

private int overloadWithoutRefusalLifetime

maximumActiveTime

private int maximumActiveTime

verbose

private boolean verbose

trace

private boolean trace

statistics

private java.lang.String statistics

statisticsLogLevel

private java.lang.String statisticsLogLevel

fatalSqlExceptions

private java.util.Set fatalSqlExceptions

fatalSqlExceptionsAsString

private java.lang.String fatalSqlExceptionsAsString
A String of all the fatalSqlExceptions delimited by ConnectionPoolDefinitionIF.FATAL_SQL_EXCEPTIONS_DELIMITER


fatalSqlExceptionWrapper

private java.lang.String fatalSqlExceptionWrapper

houseKeepingTestSql

private java.lang.String houseKeepingTestSql

testBeforeUse

private boolean testBeforeUse

testAfterUse

private boolean testAfterUse

jmx

private boolean jmx

jmxAgentId

private java.lang.String jmxAgentId

injectableConnectionInterface

private java.lang.Class injectableConnectionInterface

injectableStatementInterface

private java.lang.Class injectableStatementInterface

injectablePreparedStatementInterface

private java.lang.Class injectablePreparedStatementInterface

injectableCallableStatementInterface

private java.lang.Class injectableCallableStatementInterface
Constructor Detail

ConnectionPoolDefinition

public ConnectionPoolDefinition()
So we can set the values one by one if we want


ConnectionPoolDefinition

protected ConnectionPoolDefinition(java.lang.String url,
                                   java.util.Properties info,
                                   boolean explicitRegister)
                            throws ProxoolException
Construct a new definition

Parameters:
url - the url that defines this pool
info - additional properties (for Proxool and the delegate driver)
explicitRegister - set to true if we are registering a new pool explicitly, or false if it's just because we are serving a url that we haven't come across before
Throws:
ProxoolException - if anything goes wrong
Method Detail

update

protected void update(java.lang.String url,
                      java.util.Properties info)
               throws ProxoolException
Update the definition. All existing properties are retained and only overwritten if included in the info parameter

Parameters:
url - the url that defines this pool
info - additional properties (for Proxool and the delegate driver)
Throws:
ProxoolException - if anything goes wrong

redefine

protected void redefine(java.lang.String url,
                        java.util.Properties info)
                 throws ProxoolException
Redefine the definition. All existing properties are reset to their default values

Parameters:
url - the url that defines this pool
info - additional properties (for Proxool and the delegate driver)
Throws:
ProxoolException - if anything goes wrong

doChange

private boolean doChange(java.lang.String url,
                         java.util.Properties info,
                         boolean pretend,
                         boolean implicitRegister)
                  throws ProxoolException
Throws:
ProxoolException

logChange

private void logChange(boolean proxoolProperty,
                       java.lang.String key,
                       java.lang.String value)

setAnyProperty

private boolean setAnyProperty(java.lang.String key,
                               java.lang.String value,
                               boolean pretend)
                        throws ProxoolException
Throws:
ProxoolException

setLoggingProperty

private boolean setLoggingProperty(java.lang.String key,
                                   java.lang.String value,
                                   boolean pretend)
Subset of setAnyProperty(java.lang.String, java.lang.String, boolean) to avoid overly long method

See Also:
setAnyProperty(java.lang.String, java.lang.String, boolean)

setInjectableProperty

private boolean setInjectableProperty(java.lang.String key,
                                      java.lang.String value,
                                      boolean pretend)
Subset of setAnyProperty(java.lang.String, java.lang.String, boolean) to avoid overly long method

See Also:
setAnyProperty(java.lang.String, java.lang.String, boolean)

setHouseKeeperProperty

private boolean setHouseKeeperProperty(java.lang.String key,
                                       java.lang.String value,
                                       boolean pretend)
                                throws ProxoolException
Subset of setAnyProperty(java.lang.String, java.lang.String, boolean) to avoid overly long method.

Throws:
ProxoolException
See Also:
setAnyProperty(java.lang.String, java.lang.String, boolean)

setJndiProperty

private boolean setJndiProperty(java.lang.String key,
                                java.lang.String value,
                                boolean pretend)
Subset of setAnyProperty(java.lang.String, java.lang.String, boolean) to avoid overly long method

See Also:
setAnyProperty(java.lang.String, java.lang.String, boolean)

getInt

private int getInt(java.lang.String key,
                   java.lang.String value)
            throws ProxoolException
Throws:
ProxoolException

isChanged

private static boolean isChanged(java.lang.String oldValue,
                                 java.lang.String newValue)

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Deep clone of definition

Overrides:
clone in class java.lang.Object
Returns:
the new definition
Throws:
java.lang.CloneNotSupportedException

clearChangedInfo

private void clearChangedInfo()

reset

private void reset()
Reset all properties to their default values


getCompleteInfo

protected java.util.Properties getCompleteInfo()
Get all the properties used to define this pool

Returns:

setCompleteInfo

public void setCompleteInfo(java.util.Properties completeInfo)
Overwrite the complete info

Parameters:
completeInfo - the new properties
See Also:
getCompleteInfo()

getUser

public java.lang.String getUser()
Specified by:
getUser in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getUser()

setUser

public void setUser(java.lang.String user)
See Also:
ConnectionPoolDefinitionIF.getUser()

getPassword

public java.lang.String getPassword()
Description copied from interface: ConnectionPoolDefinitionIF
The password to use to login to the database

Specified by:
getPassword in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getPassword()

setPassword

public void setPassword(java.lang.String password)
See Also:
ConnectionPoolDefinitionIF.getPassword()

getJdbcDriverVersion

public java.lang.String getJdbcDriverVersion()
Specified by:
getJdbcDriverVersion in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getJdbcDriverVersion()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getName

public java.lang.String getName()
Deprecated. use getAlias()

Specified by:
getName in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getName()

getAlias

public java.lang.String getAlias()
Description copied from interface: ConnectionPoolDefinitionIF
The name associated with this connection pool. This is how you identify this pool when you need to use it.

Specified by:
getAlias in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getAlias()

setAlias

public void setAlias(java.lang.String alias)
See Also:
ConnectionPoolDefinitionIF.getAlias()

getMaximumConnectionLifetime

public int getMaximumConnectionLifetime()
Description copied from interface: ConnectionPoolDefinitionIF
The maximum amount of time that a connection exists for before it is killed (recycled). (milliseconds)

Specified by:
getMaximumConnectionLifetime in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getMaximumConnectionLifetime()

setMaximumConnectionLifetime

public void setMaximumConnectionLifetime(int maximumConnectionLifetime)
See Also:
ConnectionPoolDefinitionIF.getMaximumConnectionLifetime()

getPrototypeCount

public int getPrototypeCount()
Description copied from interface: ConnectionPoolDefinitionIF
This is the number of spare connections we will strive to have. So, if we have a prototypeCount of 5 but only 3 spare connections the prototyper will make an additional 2. This is important because it can take around a seconds to establish a connection, and if we are being very strict about killing connections when they get too old it happens a fair bit.

Specified by:
getPrototypeCount in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getPrototypeCount()

setPrototypeCount

public void setPrototypeCount(int prototypeCount)
See Also:
ConnectionPoolDefinitionIF.getPrototypeCount()

getMinimumConnectionCount

public int getMinimumConnectionCount()
Description copied from interface: ConnectionPoolDefinitionIF
The minimum number of connections we will keep open, regardless of whether anyone needs them or not.

Specified by:
getMinimumConnectionCount in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getMinimumConnectionCount()

setMinimumConnectionCount

public void setMinimumConnectionCount(int minimumConnectionCount)
See Also:
ConnectionPoolDefinitionIF.getMinimumConnectionCount()

getMaximumConnectionCount

public int getMaximumConnectionCount()
Description copied from interface: ConnectionPoolDefinitionIF
The maximum number of connections to the database

Specified by:
getMaximumConnectionCount in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getMaximumConnectionCount()

setMaximumConnectionCount

public void setMaximumConnectionCount(int maximumConnectionCount)
See Also:
ConnectionPoolDefinitionIF.getMaximumConnectionCount()

getHouseKeepingSleepTime

public int getHouseKeepingSleepTime()
Description copied from interface: ConnectionPoolDefinitionIF
This is the time the house keeping thread sleeps for between checks. (milliseconds)

Specified by:
getHouseKeepingSleepTime in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getHouseKeepingSleepTime()

setHouseKeepingSleepTime

public void setHouseKeepingSleepTime(int houseKeepingSleepTime)
See Also:
ConnectionPoolDefinitionIF.getHouseKeepingSleepTime()

getMaximumNewConnections

public int getMaximumNewConnections()
Deprecated. use more descriptive getSimultaneousBuildThrottle() instead

Description copied from interface: ConnectionPoolDefinitionIF
In order to prevent overloading, this is the maximum number of connections that you can have that are in the progress of being made. That is, ones we have started to make but haven't finished yet.

Specified by:
getMaximumNewConnections in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getMaximumNewConnections()

setMaximumNewConnections

public void setMaximumNewConnections(int maximumNewConnections)
Deprecated. use more descriptive setSimultaneousBuildThrottle(int) instead

See Also:
ConnectionPoolDefinitionIF.getMaximumNewConnections()

getSimultaneousBuildThrottle

public int getSimultaneousBuildThrottle()
Description copied from interface: ConnectionPoolDefinitionIF
In order to prevent overloading, this is the maximum number of connections that you can have that are in the progress of being made. That is, ones we have started to make but haven't finished yet.

Specified by:
getSimultaneousBuildThrottle in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getSimultaneousBuildThrottle()

setSimultaneousBuildThrottle

public void setSimultaneousBuildThrottle(int simultaneousBuildThrottle)
See Also:
ConnectionPoolDefinitionIF.getSimultaneousBuildThrottle()

getProperties

public java.util.Properties getProperties()
Deprecated. use less ambiguous getDelegateProperties() instead

Description copied from interface: ConnectionPoolDefinitionIF
Get all of the properties that are defined on the delegated driver.

Specified by:
getProperties in interface ConnectionPoolDefinitionIF
Returns:
the delegate properties
See Also:
ConnectionPoolDefinitionIF.getProperties()

getDelegateProperties

public java.util.Properties getDelegateProperties()
Description copied from interface: ConnectionPoolDefinitionIF
Get all of the properties that are defined on the delegated driver.

Specified by:
getDelegateProperties in interface ConnectionPoolDefinitionIF
Returns:
the delegate properties
See Also:
ConnectionPoolDefinitionIF.getDelegateProperties()

getDelegateProperty

public java.lang.String getDelegateProperty(java.lang.String name)
Get a property

Specified by:
getDelegateProperty in interface ConnectionPoolDefinitionIF
Parameters:
name - the name of the property
Returns:
the value of the property

setDelegateProperty

public void setDelegateProperty(java.lang.String name,
                                java.lang.String value)
Set a property

Parameters:
name - the name of the property
value - the value of the property
See Also:
ConnectionPoolDefinitionIF.getProperties()

setDelegateProperties

public void setDelegateProperties(java.util.Properties delegateProperties)
Overwrite the delegate properties

Parameters:
delegateProperties - the new properties
See Also:
ConnectionPoolDefinitionIF.getProperties()

getUrl

public java.lang.String getUrl()
Description copied from interface: ConnectionPoolDefinitionIF
This is the URL used to connect to the database. e.g. driver:@host:port:database.

Specified by:
getUrl in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getUrl()

setUrl

public void setUrl(java.lang.String url)
See Also:
ConnectionPoolDefinitionIF.getUrl()

getDriver

public java.lang.String getDriver()
Specified by:
getDriver in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getDriver()

setDriver

public void setDriver(java.lang.String driver)
See Also:
ConnectionPoolDefinitionIF.getDriver()

getRecentlyStartedThreshold

public int getRecentlyStartedThreshold()
Description copied from interface: ConnectionPoolDefinitionIF
As long as we have one connection that was started within this threshold then we consider the pool to be up. (That is, not down). This allows us to differentiate between having all the connections frozen and just being really busy.

Specified by:
getRecentlyStartedThreshold in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getRecentlyStartedThreshold()

setRecentlyStartedThreshold

public void setRecentlyStartedThreshold(int recentlyStartedThreshold)
See Also:
ConnectionPoolDefinitionIF.getRecentlyStartedThreshold()

getOverloadWithoutRefusalLifetime

public int getOverloadWithoutRefusalLifetime()
Description copied from interface: ConnectionPoolDefinitionIF
This is the time in milliseconds after the last time that we refused a connection that we still consider ourselves to be overloaded. We have to do this because, even when overloaded, it's not impossible for the available connection count to be high and it's possible to be serving a lot of connections. Recognising an overload is easy (we refuse a connection) - it's recognising when we stop being overloaded that is hard. Hence this fudge :)

Specified by:
getOverloadWithoutRefusalLifetime in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getOverloadWithoutRefusalLifetime()

setOverloadWithoutRefusalLifetime

public void setOverloadWithoutRefusalLifetime(int overloadWithoutRefusalLifetime)
See Also:
ConnectionPoolDefinitionIF.getOverloadWithoutRefusalLifetime()

getMaximumActiveTime

public int getMaximumActiveTime()
Description copied from interface: ConnectionPoolDefinitionIF
If the housekeeper comes across a thread that has been active for longer than this then it will kill it. So make sure you set this to a number bigger than your slowest expected response!

Specified by:
getMaximumActiveTime in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getMaximumActiveTime()

setMaximumActiveTime

public void setMaximumActiveTime(int maximumActiveTime)
See Also:
ConnectionPoolDefinitionIF.getMaximumActiveTime()

getDebugLevel

public int getDebugLevel()
Deprecated. use isVerbose() instead

Specified by:
getDebugLevel in interface ConnectionPoolDefinitionIF
See Also:
ConnectionPoolDefinitionIF.getDebugLevel()

isVerbose

public boolean isVerbose()
Description copied from interface: ConnectionPoolDefinitionIF
If this is true then we start logging a lot of stuff everytime we serve a connection and everytime the house keeper and prototyper run. Be prepared for a lot of debug!

Specified by:
isVerbose in interface ConnectionPoolDefinitionIF
Returns:
true if in verbose mode
See Also:
ConnectionPoolDefinitionIF.isVerbose()

setVerbose

public void setVerbose(boolean verbose)
See Also:
ConnectionPoolDefinitionIF.isVerbose()

isTrace

public boolean isTrace()
Description copied from interface: ConnectionPoolDefinitionIF
if this is true then we will log each execution. The SQL used and the execution time.

Specified by:
isTrace in interface ConnectionPoolDefinitionIF
Returns:
true if we should log each execution
See Also:
ConnectionPoolDefinitionIF.isTrace()

setTrace

public void setTrace(boolean trace)
See Also:
ConnectionPoolDefinitionIF.isTrace()

getCompleteUrl

public java.lang.String getCompleteUrl()
Description copied from interface: ConnectionPoolDefinitionIF
The URL that was used to define this pool. For example: proxool:org.hsqldb.jdbcDriver:jdbc:hsqldb:test

Specified by:
getCompleteUrl in interface ConnectionPoolDefinitionIF
Returns:
the complete url
See Also:
ConnectionPoolDefinitionIF.getCompleteUrl()

setCompleteUrl

public void setCompleteUrl(java.lang.String completeUrl)
See Also:
ConnectionPoolDefinitionIF.getCompleteUrl()

setFatalSqlExceptionsAsString

public void setFatalSqlExceptionsAsString(java.lang.String fatalSqlExceptionsAsString)
See Also:
ConnectionPoolDefinitionIF.getFatalSqlExceptions()

getFatalSqlExceptions

public java.util.Set getFatalSqlExceptions()
Description copied from interface: ConnectionPoolDefinitionIF
Get the list of fatal SQL exception (Strings) fragments that will trigger the death of a Connection. All SQLExceptions are caught and tested for containing this text fragment. If it matches than this connection is considered useless and it is discarded. Regardless of what happens the exception is always thrown back to the user.

Specified by:
getFatalSqlExceptions in interface ConnectionPoolDefinitionIF
Returns:
the list of exception fragments (String)
See Also:
ConnectionPoolDefinitionIF.getFatalSqlExceptions()

getFatalSqlExceptionWrapper

public java.lang.String getFatalSqlExceptionWrapper()
Description copied from interface: ConnectionPoolDefinitionIF
If this is not-null then any fatal SQLException is wrapped up inside an instance of this class. If null, then the original exception is thrown. Range: any valid class name that is a subclass of SQLException or RuntimeException Default: null (original exception is thrown)

Specified by:
getFatalSqlExceptionWrapper in interface ConnectionPoolDefinitionIF
Returns:
the class name to use for fatal SQL exceptions
See Also:
ConnectionPoolDefinitionIF.getFatalSqlExceptionWrapper()

setFatalSqlExceptionWrapper

public void setFatalSqlExceptionWrapper(java.lang.String fatalSqlExceptionWrapper)
                                 throws ProxoolException
Throws:
ProxoolException
See Also:
ConnectionPoolDefinitionIF.getFatalSqlExceptionWrapper()

getHouseKeepingTestSql

public java.lang.String getHouseKeepingTestSql()
Description copied from interface: ConnectionPoolDefinitionIF
The test SQL that we perform to see if a connection is alright. Should be fast and robust.

Specified by:
getHouseKeepingTestSql in interface ConnectionPoolDefinitionIF
Returns:
house keeping test SQL
See Also:
ConnectionPoolDefinitionIF.getHouseKeepingTestSql()

setHouseKeepingTestSql

public void setHouseKeepingTestSql(java.lang.String houseKeepingTestSql)
See Also:
ConnectionPoolDefinitionIF.getHouseKeepingTestSql()

isTestBeforeUse

public boolean isTestBeforeUse()
Description copied from interface: ConnectionPoolDefinitionIF
Whether we test each connection before it is served

Specified by:
isTestBeforeUse in interface ConnectionPoolDefinitionIF
Returns:
true if we do the test
See Also:
ConnectionPoolDefinitionIF.isTestBeforeUse()

setTestBeforeUse

public void setTestBeforeUse(boolean testBeforeUse)
See Also:
ConnectionPoolDefinitionIF.isTestBeforeUse()

isTestAfterUse

public boolean isTestAfterUse()
Description copied from interface: ConnectionPoolDefinitionIF
Whether we test each connection after it is closed (that is, returned to the pool)

Specified by:
isTestAfterUse in interface ConnectionPoolDefinitionIF
Returns:
true if we do the test
See Also:
ConnectionPoolDefinitionIF.isTestAfterUse()

setTestAfterUse

public void setTestAfterUse(boolean testAfterUse)
See Also:
ConnectionPoolDefinitionIF.isTestAfterUse()

getStatistics

public java.lang.String getStatistics()
Description copied from interface: ConnectionPoolDefinitionIF
The sample length (in seconds) when taking statistical information, or null to disable statistics. Default is null. You can comma delimit a series of periods. The suffix for the period is either "s" (seconds), "m" (minutes), "h" (hours) or "d" (days). For example: "15s,1h" would give two separate sample rates: every 15 seconds and every hour.

Specified by:
getStatistics in interface ConnectionPoolDefinitionIF
Returns:
statistics definition
See Also:
ConnectionPoolDefinitionIF.getStatistics()

setStatistics

public void setStatistics(java.lang.String statistics)
See Also:
ConnectionPoolDefinitionIF.getStatistics()

getStatisticsLogLevel

public java.lang.String getStatisticsLogLevel()
Description copied from interface: ConnectionPoolDefinitionIF
Whether statistics are logged as they are produced. Range: DEBUG, INFO, WARN, ERROR, FATAL. Default is null (no logging)

Specified by:
getStatisticsLogLevel in interface ConnectionPoolDefinitionIF
Returns:
statisticsLogLevel
See Also:
ConnectionPoolDefinitionIF.getStatisticsLogLevel()

setStatisticsLogLevel

public void setStatisticsLogLevel(java.lang.String statisticsLogLevel)
See Also:
ConnectionPoolDefinitionIF.getStatisticsLogLevel()

getJndiName

public java.lang.String getJndiName()
Description copied from interface: ConnectionPoolDefinitionIF
JNDI property

Specified by:
getJndiName in interface ConnectionPoolDefinitionIF
Returns:
JNDI name

setJndiName

public void setJndiName(java.lang.String jndiName)

getInitialContextFactory

public java.lang.String getInitialContextFactory()
Description copied from interface: ConnectionPoolDefinitionIF
JNDI property

Specified by:
getInitialContextFactory in interface ConnectionPoolDefinitionIF
Returns:
the initial context factory

setInitialContextFactory

public void setInitialContextFactory(java.lang.String initialContextFactory)

getProviderUrl

public java.lang.String getProviderUrl()
Description copied from interface: ConnectionPoolDefinitionIF
JNDI property

Specified by:
getProviderUrl in interface ConnectionPoolDefinitionIF
Returns:
provider URL

setProviderUrl

public void setProviderUrl(java.lang.String providerUrl)

getSecurityAuthentication

public java.lang.String getSecurityAuthentication()
Description copied from interface: ConnectionPoolDefinitionIF
JNDI property

Specified by:
getSecurityAuthentication in interface ConnectionPoolDefinitionIF
Returns:
security authentication

setSecurityAuthentication

public void setSecurityAuthentication(java.lang.String securityAuthentication)

getSecurityPrincipal

public java.lang.String getSecurityPrincipal()
Description copied from interface: ConnectionPoolDefinitionIF
JNDI property

Specified by:
getSecurityPrincipal in interface ConnectionPoolDefinitionIF
Returns:
security principal

setSecurityPrincipal

public void setSecurityPrincipal(java.lang.String securityPrincipal)

getSecurityCredentials

public java.lang.String getSecurityCredentials()
Description copied from interface: ConnectionPoolDefinitionIF
JNDI property

Specified by:
getSecurityCredentials in interface ConnectionPoolDefinitionIF
Returns:
security credentials

setSecurityCredentials

public void setSecurityCredentials(java.lang.String securityCredentials)

isJmx

public boolean isJmx()
Description copied from interface: ConnectionPoolDefinitionIF
Indicate wether this pool should be registered with JMX or not.

Specified by:
isJmx in interface ConnectionPoolDefinitionIF
Returns:
wether this pool should be registered with JMX or not.
See Also:
ConnectionPoolDefinitionIF.isJmx()

setJmx

public void setJmx(boolean jmx)
See Also:
ConnectionPoolDefinitionIF.isJmx()

getJmxAgentId

public java.lang.String getJmxAgentId()
Description copied from interface: ConnectionPoolDefinitionIF
Get a comma separated list of JMX agent ids (as used by MBeanServerFactory.findMBeanServer(String agentId)) to register the pool to.

Specified by:
getJmxAgentId in interface ConnectionPoolDefinitionIF
Returns:
a comma separated list of JMX agent ids (as used by MBeanServerFactory.findMBeanServer(String agentId)) to register the pool to.
See Also:
ConnectionPoolDefinitionIF.getJmxAgentId()

setJmxAgentId

public void setJmxAgentId(java.lang.String jmxAgentId)
See Also:
ConnectionPoolDefinitionIF.getJmxAgentId()

getInjectableConnectionInterface

public java.lang.Class getInjectableConnectionInterface()
Description copied from interface: ConnectionPoolDefinitionIF
The class name of an interface that should be injected everytime we make a Connection. Use this when you want to access methods on a concrete class in the vendor's Connection object that aren't declared in a public interface. Without this, the connection that gets served will only give you access to public interfaces (like Connection and any other vendor provided ones)

Specified by:
getInjectableConnectionInterface in interface ConnectionPoolDefinitionIF
Returns:
the interface
See Also:
ConnectionPoolDefinitionIF.getInjectableConnectionInterface()

getInjectableConnectionInterfaceName

public java.lang.String getInjectableConnectionInterfaceName()
See Also:
ConnectionPoolDefinitionIF.getInjectableConnectionInterface()

setInjectableConnectionInterfaceName

public void setInjectableConnectionInterfaceName(java.lang.String injectableConnectionInterfaceName)
Parameters:
injectableConnectionInterfaceName - the fully qualified class name
See Also:
ConnectionPoolDefinitionIF.getInjectableConnectionInterface()

getInjectableStatementInterface

public java.lang.Class getInjectableStatementInterface()
Description copied from interface: ConnectionPoolDefinitionIF
The class name of an interface that should be injected everytime we make a Statement. Use this when you want to access methods on a concrete class in the vendor's Statement object that aren't declared in a public interface. Without this, the statement that is provided will only give you access to public interfaces (like Statement and any other vendor provided ones)

Specified by:
getInjectableStatementInterface in interface ConnectionPoolDefinitionIF
Returns:
the interface
See Also:
ConnectionPoolDefinitionIF.getInjectableStatementInterface()

getInjectableStatementInterfaceName

public java.lang.String getInjectableStatementInterfaceName()
See Also:
ConnectionPoolDefinitionIF.getInjectableStatementInterface()

setInjectableStatementInterfaceName

public void setInjectableStatementInterfaceName(java.lang.String injectableStatementInterfaceName)
Parameters:
injectableStatementInterfaceName - the fully qualified class name
See Also:
ConnectionPoolDefinitionIF.getInjectableStatementInterface()

getInjectablePreparedStatementInterface

public java.lang.Class getInjectablePreparedStatementInterface()
Description copied from interface: ConnectionPoolDefinitionIF
The class name of an interface that should be injected everytime we make a PreparedStatement. Use this when you want to access methods on a concrete class in the vendor's PreparedStatement object that aren't declared in a public interface. Without this, the PreparedStatement that is provided will only give you access to public interfaces (like PreparedStatement and any other vendor provided ones)

Specified by:
getInjectablePreparedStatementInterface in interface ConnectionPoolDefinitionIF
Returns:
the interface
See Also:
ConnectionPoolDefinitionIF.getInjectablePreparedStatementInterface()

getInjectablePreparedStatementInterfaceName

public java.lang.String getInjectablePreparedStatementInterfaceName()
See Also:
ConnectionPoolDefinitionIF.getInjectablePreparedStatementInterface()

setInjectablePreparedStatementInterfaceName

public void setInjectablePreparedStatementInterfaceName(java.lang.String injectablePreparedStatementInterfaceName)
Parameters:
injectablePreparedStatementInterfaceName - the fully qualified class name
See Also:
ConnectionPoolDefinitionIF.getInjectablePreparedStatementInterface()

getInjectableCallableStatememtInterfaceName

public java.lang.String getInjectableCallableStatememtInterfaceName()
See Also:
ConnectionPoolDefinitionIF.getInjectableCallableStatementInterface()

getInjectableCallableStatementInterface

public java.lang.Class getInjectableCallableStatementInterface()
Description copied from interface: ConnectionPoolDefinitionIF
The class name of an interface that should be injected everytime we make a CallableStatement. Use this when you want to access methods on a concrete class in the vendor's CallableStatement object that aren't declared in a public interface. Without this, the CallableStatement that is provided will only give you access to public interfaces (like CallableStatement and any other vendor provided ones)

Specified by:
getInjectableCallableStatementInterface in interface ConnectionPoolDefinitionIF
Returns:
the interface
See Also:
ConnectionPoolDefinitionIF.getInjectableCallableStatementInterface()

setInjectableCallableStatementInterfaceName

public void setInjectableCallableStatementInterfaceName(java.lang.String injectableCallableStatementInterfaceName)
Parameters:
injectableCallableStatementInterfaceName - the fully qualified class name
See Also:
ConnectionPoolDefinitionIF.getInjectableCallableStatementInterface()

getInterface

private java.lang.Class getInterface(java.lang.String className)

isEqual

public boolean isEqual(java.lang.String url,
                       java.util.Properties info)
Returns true if redefining the pool using these parameters would not change the definition. You can use this to decide whether or not to trigger a change event.

Parameters:
url - the url (containing alias and possible delegate url and driver)
info - the properties
Returns:
true if the definition is identical to that that represented by these parameters