Package org.logicalcobwebs.proxool
Interface ConnectionPoolDefinitionIF
-
public interface ConnectionPoolDefinitionIF
A full definition of everything to do with a connection. You can get one of these fromProxoolFacade
.String alias = "myPool"; ConnectionPoolDefinitionIF cpd = ProxoolFacade.getConnectionPoolDefinition(alias);
If you want to update the definition you should either update the properties definition next time youask
for a connection or callProxool
directly.- Version:
- $Revision: 1.23 $, $Date: 2007/06/19 11:33:35 $
- Author:
- billhorsman, $Author: billhorsman $ (current maintainer)
-
-
Field Summary
Fields Modifier and Type Field Description 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
15static int
DEFAULT_MAXIMUM_CONNECTION_LIFETIME
4 * 60 * 60 * 1000 (4 hours)static int
DEFAULT_MAXIMUM_NEW_CONNECTIONS
Deprecated.useDEFAULT_SIMULTANEOUS_BUILD_THROTTLE
insteadstatic int
DEFAULT_MINIMUM_CONNECTION_COUNT
0static int
DEFAULT_OVERLOAD_WITHOUT_REFUSAL_THRESHOLD
60000static int
DEFAULT_PROTOTYPE_COUNT
0static int
DEFAULT_RECENTLY_STARTED_THRESHOLD
60000static int
DEFAULT_SIMULTANEOUS_BUILD_THROTTLE
10static java.lang.String
FATAL_SQL_EXCEPTIONS_DELIMITER
static java.lang.String
PASSWORD_PROPERTY
static java.lang.String
USER_PROPERTY
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.String
getAlias()
The name associated with this connection pool.java.lang.String
getCompleteUrl()
The URL that was used to define this pool.int
getDebugLevel()
Deprecated.useisVerbose()
insteadjava.util.Properties
getDelegateProperties()
Get all of the properties that are defined on the delegated driver.java.lang.String
getDelegateProperty(java.lang.String name)
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.long
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 propertyjava.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.Class
getInjectablePreparedStatementInterface()
The class name of an interface that should be injected everytime we make a PreparedStatement.java.lang.Class
getInjectableStatementInterface()
The class name of an interface that should be injected everytime we make a Statement.java.lang.String
getJdbcDriverVersion()
java.lang.String
getJmxAgentId()
Get a comma separated list of JMX agent ids (as used byMBeanServerFactory.findMBeanServer(String agentId)
) to register the pool to.java.lang.String
getJndiName()
JNDI propertylong
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 databaselong
getMaximumConnectionLifetime()
The maximum amount of time that a connection exists for before it is killed (recycled).int
getMaximumNewConnections()
Deprecated.use more descriptivegetSimultaneousBuildThrottle()
insteadint
getMinimumConnectionCount()
The minimum number of connections we will keep open, regardless of whether anyone needs them or not.java.lang.String
getName()
Deprecated.usegetAlias()
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.java.lang.String
getPassword()
The password to use to login to the databasejava.util.Properties
getProperties()
Deprecated.use less ambiguousgetDelegateProperties()
insteadint
getPrototypeCount()
This is the number of spare connections we will strive to have.java.lang.String
getProviderUrl()
JNDI propertylong
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 propertyjava.lang.String
getSecurityCredentials()
JNDI propertyjava.lang.String
getSecurityPrincipal()
JNDI propertyint
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()
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 servedboolean
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 Detail
-
DEFAULT_MAXIMUM_CONNECTION_LIFETIME
static final int DEFAULT_MAXIMUM_CONNECTION_LIFETIME
4 * 60 * 60 * 1000 (4 hours)- See Also:
- Constant Field Values
-
DEFAULT_MAXIMUM_ACTIVE_TIME
static final int DEFAULT_MAXIMUM_ACTIVE_TIME
300000 (5 minutes)- See Also:
- Constant Field Values
-
DEFAULT_PROTOTYPE_COUNT
static final int DEFAULT_PROTOTYPE_COUNT
0- See Also:
- Constant Field Values
-
DEFAULT_MINIMUM_CONNECTION_COUNT
static final int DEFAULT_MINIMUM_CONNECTION_COUNT
0- See Also:
- Constant Field Values
-
DEFAULT_MAXIMUM_CONNECTION_COUNT
static final int DEFAULT_MAXIMUM_CONNECTION_COUNT
15- See Also:
- Constant Field Values
-
DEFAULT_HOUSE_KEEPING_SLEEP_TIME
static final int DEFAULT_HOUSE_KEEPING_SLEEP_TIME
30000 (30 Seconds)- See Also:
- Constant Field Values
-
DEFAULT_MAXIMUM_NEW_CONNECTIONS
static final int DEFAULT_MAXIMUM_NEW_CONNECTIONS
Deprecated.useDEFAULT_SIMULTANEOUS_BUILD_THROTTLE
instead10- See Also:
- Constant Field Values
-
DEFAULT_SIMULTANEOUS_BUILD_THROTTLE
static final int DEFAULT_SIMULTANEOUS_BUILD_THROTTLE
10- See Also:
- Constant Field Values
-
DEFAULT_OVERLOAD_WITHOUT_REFUSAL_THRESHOLD
static final int DEFAULT_OVERLOAD_WITHOUT_REFUSAL_THRESHOLD
60000- See Also:
- Constant Field Values
-
DEFAULT_RECENTLY_STARTED_THRESHOLD
static final int DEFAULT_RECENTLY_STARTED_THRESHOLD
60000- See Also:
- Constant Field Values
-
DEBUG_LEVEL_QUIET
static final int DEBUG_LEVEL_QUIET
- See Also:
- Constant Field Values
-
DEBUG_LEVEL_LOUD
static final int DEBUG_LEVEL_LOUD
- See Also:
- Constant Field Values
-
USER_PROPERTY
static final java.lang.String USER_PROPERTY
- See Also:
- Constant Field Values
-
PASSWORD_PROPERTY
static final java.lang.String PASSWORD_PROPERTY
- See Also:
- Constant Field Values
-
FATAL_SQL_EXCEPTIONS_DELIMITER
static final java.lang.String FATAL_SQL_EXCEPTIONS_DELIMITER
- See Also:
getFatalSqlExceptions()
, Constant Field Values
-
-
Method Detail
-
getHouseKeepingSleepTime
long getHouseKeepingSleepTime()
This is the time the house keeping thread sleeps for between checks. (milliseconds)
-
getMaximumConnectionCount
int getMaximumConnectionCount()
The maximum number of connections to the database
-
getMaximumConnectionLifetime
long getMaximumConnectionLifetime()
The maximum amount of time that a connection exists for before it is killed (recycled). (milliseconds)
-
getMaximumNewConnections
int getMaximumNewConnections()
Deprecated.use more descriptivegetSimultaneousBuildThrottle()
insteadIn 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.
-
getSimultaneousBuildThrottle
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.
-
getMinimumConnectionCount
int getMinimumConnectionCount()
The minimum number of connections we will keep open, regardless of whether anyone needs them or not.
-
getName
java.lang.String getName()
Deprecated.usegetAlias()
instead.
-
getAlias
java.lang.String getAlias()
The name associated with this connection pool. This is how you identify this pool when you need to use it.
-
getPassword
java.lang.String getPassword()
The password to use to login to the database
-
getPrototypeCount
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.
-
getUrl
java.lang.String getUrl()
This is the URL used to connect to the database. e.g. driver:@host:port:database.
-
getUser
java.lang.String getUser()
-
getJdbcDriverVersion
java.lang.String getJdbcDriverVersion()
-
getProperties
java.util.Properties getProperties()
Deprecated.use less ambiguousgetDelegateProperties()
insteadGet all of the properties that are defined on the delegated driver.- Returns:
- the delegate properties
-
getDriver
java.lang.String getDriver()
-
getRecentlyStartedThreshold
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.
-
getOverloadWithoutRefusalLifetime
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 :)
-
getMaximumActiveTime
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!
-
getDebugLevel
int getDebugLevel()
Deprecated.useisVerbose()
instead
-
getFatalSqlExceptions
java.util.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)
- See Also:
FATAL_SQL_EXCEPTIONS_DELIMITER
-
getHouseKeepingTestSql
java.lang.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
-
isTestBeforeUse
boolean isTestBeforeUse()
Whether we test each connection before it is served- Returns:
- true if we do the test
- See Also:
getHouseKeepingTestSql()
-
isTestAfterUse
boolean isTestAfterUse()
Whether we test each connection after it is closed (that is, returned to the pool)- Returns:
- true if we do the test
- See Also:
getHouseKeepingTestSql()
-
getCompleteUrl
java.lang.String getCompleteUrl()
The URL that was used to define this pool. For example: proxool:org.hsqldb.jdbcDriver:jdbc:hsqldb:test- Returns:
- the complete url
-
isVerbose
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
-
isTrace
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
-
getStatistics
java.lang.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
java.lang.String getStatisticsLogLevel()
Whether statistics are logged as they are produced. Range: DEBUG, INFO, WARN, ERROR, FATAL. Default is null (no logging)- Returns:
- statisticsLogLevel
-
getDelegateProperties
java.util.Properties getDelegateProperties()
Get all of the properties that are defined on the delegated driver.- Returns:
- the delegate properties
-
getDelegateProperty
java.lang.String getDelegateProperty(java.lang.String name)
-
getFatalSqlExceptionWrapper
java.lang.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
-
getInitialContextFactory
java.lang.String getInitialContextFactory()
JNDI property- Returns:
- the initial context factory
-
getProviderUrl
java.lang.String getProviderUrl()
JNDI property- Returns:
- provider URL
-
getSecurityAuthentication
java.lang.String getSecurityAuthentication()
JNDI property- Returns:
- security authentication
-
getSecurityPrincipal
java.lang.String getSecurityPrincipal()
JNDI property- Returns:
- security principal
-
getSecurityCredentials
java.lang.String getSecurityCredentials()
JNDI property- Returns:
- security credentials
-
getJndiName
java.lang.String getJndiName()
JNDI property- Returns:
- JNDI name
-
isJmx
boolean isJmx()
Indicate wether this pool should be registered with JMX or not.- Returns:
- wether this pool should be registered with JMX or not.
-
getJmxAgentId
java.lang.String getJmxAgentId()
Get a comma separated list of JMX agent ids (as used byMBeanServerFactory.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.
-
getInjectableConnectionInterface
java.lang.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
-
getInjectableStatementInterface
java.lang.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
-
getInjectablePreparedStatementInterface
java.lang.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
-
getInjectableCallableStatementInterface
java.lang.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
-
-