Package org.opencms.db
Class CmsDbPoolV11
java.lang.Object
org.opencms.db.CmsDbPoolV11
Database connection pool class using HikariCP.
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey for number of connection attempts.static final StringKey for connection waiting.static final StringPrefix for database keys.static final StringKey for the database name.static final StringKey for the pool id.static final StringKey for the entity manager pool size.static final StringKey for jdbc driver.static final StringKey for jdbc url.static final StringKey for jdbc url params.static final StringKey for database password.static final StringKey for default.static final StringKey for pool url.static final StringKey for pool user.static final StringKey for vfs pool.static final StringKey for user name.static final StringThe name of the opencms default pool.static final StringThe default OpenCms JDBC pool URL.static final StringThe prefix used for opencms JDBC pools. - 
Constructor Summary
ConstructorsConstructorDescriptionCmsDbPoolV11(CmsParameterConfiguration config, String key) Default constructor. - 
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the pool.static com.zaxxer.hikari.HikariConfigcreateHikariConfig(CmsParameterConfiguration config, String key) Creates the HikariCP configuration based on the configuration of a pool defined in opencms.properties.intReturns the number of active connections.Gets a database connection from the pool.static StringReturns the name of the default database connection pool.intGets the number of idle connections.Gets the pool url.static StringgetPropertyRelativeSuffix(String prefix, String str) If str starts with prefix + '.', return the remaining part, otherwise return null. 
- 
Field Details
- 
KEY_DATABASE
Prefix for database keys.- See Also:
 
 - 
KEY_DATABASE_NAME
Key for the database name.- See Also:
 
 - 
KEY_DATABASE_POOL
Key for the pool id.- See Also:
 
 - 
KEY_CONNECT_ATTEMTS
Key for number of connection attempts.- See Also:
 
 - 
KEY_CONNECT_WAITS
Key for connection waiting.- See Also:
 
 - 
KEY_ENTITY_MANAGER_POOL_SIZE
Key for the entity manager pool size.- See Also:
 
 - 
KEY_JDBC_DRIVER
Key for jdbc driver.- See Also:
 
 - 
KEY_JDBC_URL
Key for jdbc url.- See Also:
 
 - 
KEY_JDBC_URL_PARAMS
Key for jdbc url params.- See Also:
 
 - 
KEY_PASSWORD
Key for database password.- See Also:
 
 - 
KEY_POOL_DEFAULT
Key for default.- See Also:
 
 - 
KEY_POOL_URL
Key for pool url.- See Also:
 
 - 
KEY_POOL_USER
Key for pool user.- See Also:
 
 - 
KEY_POOL_VFS
Key for vfs pool.- See Also:
 
 - 
KEY_USERNAME
Key for user name.- See Also:
 
 - 
OPENCMS_DEFAULT_POOL_NAME
The name of the opencms default pool.- See Also:
 
 - 
OPENCMS_DEFAULT_POOL_URL
The default OpenCms JDBC pool URL.- See Also:
 
 - 
OPENCMS_URL_PREFIX
The prefix used for opencms JDBC pools.- See Also:
 
 
 - 
 - 
Constructor Details
- 
CmsDbPoolV11
Default constructor.- Parameters:
 config- the OpenCms configuration (opencms.properties)key- the name of the pool (without the opencms: prefix)- Throws:
 Exception- if something goes wrong
 
 - 
 - 
Method Details
- 
createHikariConfig
public static com.zaxxer.hikari.HikariConfig createHikariConfig(CmsParameterConfiguration config, String key) Creates the HikariCP configuration based on the configuration of a pool defined in opencms.properties.- Parameters:
 config- the configuration object with the propertieskey- the pool name (without the opencms prefix)- Returns:
 - the HikariCP configuration for the pool
 
 - 
getDefaultDbPoolName
Returns the name of the default database connection pool.- Returns:
 - the name of the default database connection pool
 
 - 
getPropertyRelativeSuffix
If str starts with prefix + '.', return the remaining part, otherwise return null.- Parameters:
 prefix- the prefixstr- the string to remove the prefix from- Returns:
 - str with the prefix removed, or null if it didn't start with prefix + '.'
 
 - 
close
Closes the pool.- Throws:
 Exception- if something goes wrong
 - 
getActiveConnections
Returns the number of active connections.- Returns:
 - the number of active connections
 
 - 
getConnection
Gets a database connection from the pool.- Returns:
 - the database connection
 - Throws:
 SQLException- if something goes wrong
 - 
getIdleConnections
Gets the number of idle connections.- Returns:
 - the number of idle connections
 
 - 
getPoolUrl
Gets the pool url.- Returns:
 - the pool url
 
 
 -