Package org.apache.tomcat.jdbc.pool
Class DataSourceFactory
java.lang.Object
org.apache.tomcat.jdbc.pool.DataSourceFactory
- All Implemented Interfaces:
ObjectFactory
JNDI object factory that creates an instance of
BasicDataSource
that has been configured based on the
RefAddr
values of the specified Reference
,
which must match the names and data types of the
BasicDataSource
bean properties.
Properties available for configuration:
Commons DBCP properties
- initSQL - A query that gets executed once, right after the connection is established.
- testOnConnect - run validationQuery after connection has been established.
- validationInterval - avoid excess validation, only run validation at most at this frequency - time in milliseconds.
- jdbcInterceptors - a semicolon separated list of classnames extending
JdbcInterceptor
class. - jmxEnabled - true of false, whether to register the pool with JMX.
- fairQueue - true of false, whether the pool should sacrifice a little bit of performance for true fairness.
- Author:
- Craig R. McClanahan, Dirk Verbeeck
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String[]
static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateDataSource
(Properties properties) Creates and configures aDataSource
instance based on the given properties.createDataSource
(Properties properties, Context context, boolean XA) getObjectInstance
(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) Create and return a newBasicDataSource
instance.protected static Properties
getProperties
(String propText) Parse properties from the string.static PoolConfiguration
parsePoolProperties
(Properties properties) void
performJNDILookup
(Context context, PoolConfiguration poolProperties)
-
Field Details
-
PROP_DEFAULTAUTOCOMMIT
- See Also:
-
PROP_DEFAULTREADONLY
- See Also:
-
PROP_DEFAULTTRANSACTIONISOLATION
- See Also:
-
PROP_DEFAULTCATALOG
- See Also:
-
PROP_DRIVERCLASSNAME
- See Also:
-
PROP_PASSWORD
- See Also:
-
PROP_URL
- See Also:
-
PROP_USERNAME
- See Also:
-
PROP_MAXACTIVE
- See Also:
-
PROP_MAXIDLE
- See Also:
-
PROP_MINIDLE
- See Also:
-
PROP_INITIALSIZE
- See Also:
-
PROP_MAXWAIT
- See Also:
-
PROP_MAXAGE
- See Also:
-
PROP_TESTONBORROW
- See Also:
-
PROP_TESTONRETURN
- See Also:
-
PROP_TESTWHILEIDLE
- See Also:
-
PROP_TESTONCONNECT
- See Also:
-
PROP_VALIDATIONQUERY
- See Also:
-
PROP_VALIDATIONQUERY_TIMEOUT
- See Also:
-
PROP_VALIDATOR_CLASS_NAME
- See Also:
-
PROP_NUMTESTSPEREVICTIONRUN
- See Also:
-
PROP_TIMEBETWEENEVICTIONRUNSMILLIS
- See Also:
-
PROP_MINEVICTABLEIDLETIMEMILLIS
- See Also:
-
PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED
- See Also:
-
PROP_REMOVEABANDONED
- See Also:
-
PROP_REMOVEABANDONEDTIMEOUT
- See Also:
-
PROP_LOGABANDONED
- See Also:
-
PROP_ABANDONWHENPERCENTAGEFULL
- See Also:
-
PROP_POOLPREPAREDSTATEMENTS
- See Also:
-
PROP_MAXOPENPREPAREDSTATEMENTS
- See Also:
-
PROP_CONNECTIONPROPERTIES
- See Also:
-
PROP_INITSQL
- See Also:
-
PROP_INTERCEPTORS
- See Also:
-
PROP_VALIDATIONINTERVAL
- See Also:
-
PROP_JMX_ENABLED
- See Also:
-
PROP_FAIR_QUEUE
- See Also:
-
PROP_USE_EQUALS
- See Also:
-
PROP_USE_CON_LOCK
- See Also:
-
PROP_DATASOURCE
- See Also:
-
PROP_DATASOURCE_JNDI
- See Also:
-
PROP_SUSPECT_TIMEOUT
- See Also:
-
PROP_ALTERNATE_USERNAME_ALLOWED
- See Also:
-
PROP_COMMITONRETURN
- See Also:
-
PROP_ROLLBACKONRETURN
- See Also:
-
PROP_USEDISPOSABLECONNECTIONFACADE
- See Also:
-
PROP_LOGVALIDATIONERRORS
- See Also:
-
PROP_PROPAGATEINTERRUPTSTATE
- See Also:
-
PROP_IGNOREEXCEPTIONONPRELOAD
- See Also:
-
PROP_USESTATEMENTFACADE
- See Also:
-
UNKNOWN_TRANSACTIONISOLATION
public static final int UNKNOWN_TRANSACTIONISOLATION- See Also:
-
OBJECT_NAME
- See Also:
-
ALL_PROPERTIES
-
-
Constructor Details
-
DataSourceFactory
public DataSourceFactory()
-
-
Method Details
-
getObjectInstance
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws ExceptionCreate and return a new
BasicDataSource
instance. If no instance can be created, returnnull
instead.- Specified by:
getObjectInstance
in interfaceObjectFactory
- Parameters:
obj
- The possibly null object containing location or reference information that can be used in creating an objectname
- The name of this object relative tonameCtx
nameCtx
- The context relative to which thename
parameter is specified, ornull
ifname
is relative to the default initial contextenvironment
- The possibly null environment that is used in creating this object- Throws:
Exception
- if an exception occurs creating the instance
-
parsePoolProperties
-
createDataSource
Creates and configures aDataSource
instance based on the given properties.- Parameters:
properties
- the datasource configuration properties- Returns:
- the datasource
- Throws:
Exception
- if an error occurs creating the data source
-
createDataSource
public DataSource createDataSource(Properties properties, Context context, boolean XA) throws Exception - Throws:
Exception
-
performJNDILookup
-
getProperties
Parse properties from the string. Format of the string must be [propertyName=property;]*.- Parameters:
propText
- The properties string- Returns:
- the properties
-