org.logicalcobwebs.proxool

Interface ConnectionPoolDefinitionIF

public interface ConnectionPoolDefinitionIF

A full definition of everything to do with a connection. You can get one of these from ProxoolFacade.
 String alias = "myPool";
 ConnectionPoolDefinitionIF cpd = ProxoolFacade.getConnectionPoolDefinition(alias);
 
If you want to update the definition you should either update the properties definition next time you ask for a connection or call Proxool directly.
Version:
$Revision: 1.23 $, $Date: 2007/06/19 11:33:35 $
Authors:
billhorsman
$Author: billhorsman $ (current maintainer)

Field Summary

static int
DEBUG_LEVEL_LOUD
static int
DEBUG_LEVEL_QUIET
static int
DEFAULT_HOUSE_KEEPING_SLEEP_TIME
30000 (30 Seconds)
static int
DEFAULT_MAXIMUM_ACTIVE_TIME
300000 (5 minutes)
static int
DEFAULT_MAXIMUM_CONNECTION_COUNT
15
static int
DEFAULT_MAXIMUM_CONNECTION_LIFETIME
4 * 60 * 60 * 1000 (4 hours)
static int
DEFAULT_MAXIMUM_NEW_CONNECTIONS
Deprecated. use DEFAULT_SIMULTANEOUS_BUILD_THROTTLE instead
static int
DEFAULT_MINIMUM_CONNECTION_COUNT
0
static int
DEFAULT_OVERLOAD_WITHOUT_REFUSAL_THRESHOLD
60000
static int
DEFAULT_PROTOTYPE_COUNT
0
static int
DEFAULT_RECENTLY_STARTED_THRESHOLD
60000
static int
DEFAULT_SIMULTANEOUS_BUILD_THROTTLE
10
static String
FATAL_SQL_EXCEPTIONS_DELIMITER
static String
PASSWORD_PROPERTY
static String
USER_PROPERTY

Method Summary

String
getAlias()
The name associated with this connection pool.
String
getCompleteUrl()
The URL that was used to define this pool.
int
getDebugLevel()
Deprecated. use isVerbose() instead
Properties
getDelegateProperties()
Get all of the properties that are defined on the delegated driver.
String
getDelegateProperty(String name)
String
getDriver()
String
getFatalSqlExceptionWrapper()
If this is not-null then any fatal SQLException is wrapped up inside an instance of this class.
Set
getFatalSqlExceptions()
Get the list of fatal SQL exception (Strings) fragments that will trigger the death of a Connection.
long
getHouseKeepingSleepTime()
This is the time the house keeping thread sleeps for between checks.
String
getHouseKeepingTestSql()
The test SQL that we perform to see if a connection is alright.
String
getInitialContextFactory()
JNDI property
Class
getInjectableCallableStatementInterface()
The class name of an interface that should be injected everytime we make a CallableStatement.
Class
getInjectableConnectionInterface()
The class name of an interface that should be injected everytime we make a Connection.
Class
getInjectablePreparedStatementInterface()
The class name of an interface that should be injected everytime we make a PreparedStatement.
Class
getInjectableStatementInterface()
The class name of an interface that should be injected everytime we make a Statement.
String
getJdbcDriverVersion()
String
getJmxAgentId()
Get a comma separated list of JMX agent ids (as used by MBeanServerFactory.findMBeanServer(String agentId)) to register the pool to.
String
getJndiName()
JNDI property
long
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
long
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.
String
getName()
Deprecated. use getAlias() instead.
long
getOverloadWithoutRefusalLifetime()
This is the time in milliseconds after the last time that we refused a connection that we still consider ourselves to be overloaded.
String
getPassword()
The password to use to login to the database
Properties
getProperties()
Deprecated. use less ambiguous getDelegateProperties() instead
int
getPrototypeCount()
This is the number of spare connections we will strive to have.
String
getProviderUrl()
JNDI property
long
getRecentlyStartedThreshold()
As long as we have one connection that was started within this threshold then we consider the pool to be up.
String
getSecurityAuthentication()
JNDI property
String
getSecurityCredentials()
JNDI property
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.
String
getStatistics()
The sample length (in seconds) when taking statistical information, or null to disable statistics.
String
getStatisticsLogLevel()
Whether statistics are logged as they are produced.
String
getUrl()
This is the URL used to connect to the database.
String
getUser()
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.

Field Details

DEBUG_LEVEL_LOUD

public static final int DEBUG_LEVEL_LOUD
Field Value:
1

DEBUG_LEVEL_QUIET

public static final int DEBUG_LEVEL_QUIET
Field Value:
0

DEFAULT_HOUSE_KEEPING_SLEEP_TIME

public static final int DEFAULT_HOUSE_KEEPING_SLEEP_TIME
30000 (30 Seconds)
Field Value:
30000

DEFAULT_MAXIMUM_ACTIVE_TIME

public static final int DEFAULT_MAXIMUM_ACTIVE_TIME
300000 (5 minutes)
Field Value:
300000

DEFAULT_MAXIMUM_CONNECTION_COUNT

public static final int DEFAULT_MAXIMUM_CONNECTION_COUNT
15
Field Value:
15

DEFAULT_MAXIMUM_CONNECTION_LIFETIME

public static final int DEFAULT_MAXIMUM_CONNECTION_LIFETIME
4 * 60 * 60 * 1000 (4 hours)
Field Value:
14400000

DEFAULT_MAXIMUM_NEW_CONNECTIONS

public static final int DEFAULT_MAXIMUM_NEW_CONNECTIONS

Deprecated. use DEFAULT_SIMULTANEOUS_BUILD_THROTTLE instead

10
Field Value:
10

DEFAULT_MINIMUM_CONNECTION_COUNT

public static final int DEFAULT_MINIMUM_CONNECTION_COUNT
0
Field Value:
0

DEFAULT_OVERLOAD_WITHOUT_REFUSAL_THRESHOLD

public static final int DEFAULT_OVERLOAD_WITHOUT_REFUSAL_THRESHOLD
60000
Field Value:
60000

DEFAULT_PROTOTYPE_COUNT

public static final int DEFAULT_PROTOTYPE_COUNT
0
Field Value:
0

DEFAULT_RECENTLY_STARTED_THRESHOLD

public static final int DEFAULT_RECENTLY_STARTED_THRESHOLD
60000
Field Value:
60000

DEFAULT_SIMULTANEOUS_BUILD_THROTTLE

public static final int DEFAULT_SIMULTANEOUS_BUILD_THROTTLE
10
Field Value:
10

FATAL_SQL_EXCEPTIONS_DELIMITER

public static final String FATAL_SQL_EXCEPTIONS_DELIMITER

PASSWORD_PROPERTY

public static final String PASSWORD_PROPERTY

USER_PROPERTY

public static final String USER_PROPERTY

Method Details

getAlias

public String getAlias()
The name associated with this connection pool. This is how you identify this pool when you need to use it.

getCompleteUrl

public String getCompleteUrl()
The URL that was used to define this pool. For example: proxool:org.hsqldb.jdbcDriver:jdbc:hsqldb:test
Returns:
the complete url

getDebugLevel

public int getDebugLevel()

Deprecated. use isVerbose() instead


getDelegateProperties

public Properties getDelegateProperties()
Get all of the properties that are defined on the delegated driver.
Returns:
the delegate properties

getDelegateProperty

public String getDelegateProperty(String name)

getDriver

public String getDriver()

getFatalSqlExceptionWrapper

public String getFatalSqlExceptionWrapper()
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)
Returns:
the class name to use for fatal SQL exceptions

getFatalSqlExceptions

public Set getFatalSqlExceptions()
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.
Returns:
the list of exception fragments (String)

getHouseKeepingSleepTime

public long getHouseKeepingSleepTime()
This is the time the house keeping thread sleeps for between checks. (milliseconds)

getHouseKeepingTestSql

public String getHouseKeepingTestSql()
The test SQL that we perform to see if a connection is alright. Should be fast and robust.
Returns:
house keeping test SQL

getInitialContextFactory

public String getInitialContextFactory()
JNDI property
Returns:
the initial context factory

getInjectableCallableStatementInterface

public Class getInjectableCallableStatementInterface()
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)
Returns:
the interface

getInjectableConnectionInterface

public Class getInjectableConnectionInterface()
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)
Returns:
the interface

getInjectablePreparedStatementInterface

public Class getInjectablePreparedStatementInterface()
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)
Returns:
the interface

getInjectableStatementInterface

public Class getInjectableStatementInterface()
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)
Returns:
the interface

getJdbcDriverVersion

public String getJdbcDriverVersion()

getJmxAgentId

public String getJmxAgentId()
Get a comma separated list of JMX agent ids (as used by MBeanServerFactory.findMBeanServer(String agentId)) to register the pool to.
Returns:
a comma separated list of JMX agent ids (as used by MBeanServerFactory.findMBeanServer(String agentId)) to register the pool to.

getJndiName

public String getJndiName()
JNDI property
Returns:
JNDI name

getMaximumActiveTime

public long getMaximumActiveTime()
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!

getMaximumConnectionCount

public int getMaximumConnectionCount()
The maximum number of connections to the database

getMaximumConnectionLifetime

public long getMaximumConnectionLifetime()
The maximum amount of time that a connection exists for before it is killed (recycled). (milliseconds)

getMaximumNewConnections

public int getMaximumNewConnections()

Deprecated. use more descriptive getSimultaneousBuildThrottle() instead

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.

getMinimumConnectionCount

public int getMinimumConnectionCount()
The minimum number of connections we will keep open, regardless of whether anyone needs them or not.

getName

public String getName()

Deprecated. use getAlias() instead.


getOverloadWithoutRefusalLifetime

public long getOverloadWithoutRefusalLifetime()
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 :)

getPassword

public String getPassword()
The password to use to login to the database

getProperties

public Properties getProperties()

Deprecated. use less ambiguous getDelegateProperties() instead

Get all of the properties that are defined on the delegated driver.
Returns:
the delegate properties

getPrototypeCount

public int getPrototypeCount()
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.

getProviderUrl

public String getProviderUrl()
JNDI property
Returns:
provider URL

getRecentlyStartedThreshold

public long getRecentlyStartedThreshold()
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.

getSecurityAuthentication

public String getSecurityAuthentication()
JNDI property
Returns:
security authentication

getSecurityCredentials

public String getSecurityCredentials()
JNDI property
Returns:
security credentials

getSecurityPrincipal

public String getSecurityPrincipal()
JNDI property
Returns:
security principal

getSimultaneousBuildThrottle

public 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. That is, ones we have started to make but haven't finished yet.

getStatistics

public String getStatistics()
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.
Returns:
statistics definition

getStatisticsLogLevel

public String getStatisticsLogLevel()
Whether statistics are logged as they are produced. Range: DEBUG, INFO, WARN, ERROR, FATAL. Default is null (no logging)
Returns:
statisticsLogLevel

getUrl

public String getUrl()
This is the URL used to connect to the database. e.g. driver:@host:port:database.

getUser

public String getUser()

isJmx

public boolean isJmx()
Indicate wether this pool should be registered with JMX or not.
Returns:
wether this pool should be registered with JMX or not.

isTestAfterUse

public boolean isTestAfterUse()
Whether we test each connection after it is closed (that is, returned to the pool)
Returns:
true if we do the test

isTestBeforeUse

public boolean isTestBeforeUse()
Whether we test each connection before it is served
Returns:
true if we do the test

isTrace

public boolean isTrace()
if this is true then we will log each execution. The SQL used and the execution time.
Returns:
true if we should log each execution

isVerbose

public 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. Be prepared for a lot of debug!
Returns:
true if in verbose mode