public final class CmsDbPoolV11 extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_CONNECT_ATTEMTS
Key for number of connection attempts.
|
static java.lang.String |
KEY_CONNECT_WAITS
Key for connection waiting.
|
static java.lang.String |
KEY_DATABASE
Prefix for database keys.
|
static java.lang.String |
KEY_DATABASE_NAME
Key for the database name.
|
static java.lang.String |
KEY_DATABASE_POOL
Key for the pool id.
|
static java.lang.String |
KEY_ENTITY_MANAGER_POOL_SIZE
Key for the entity manager pool size.
|
static java.lang.String |
KEY_JDBC_DRIVER
Key for jdbc driver.
|
static java.lang.String |
KEY_JDBC_URL
Key for jdbc url.
|
static java.lang.String |
KEY_JDBC_URL_PARAMS
Key for jdbc url params.
|
static java.lang.String |
KEY_PASSWORD
Key for database password.
|
static java.lang.String |
KEY_POOL_DEFAULT
Key for default.
|
static java.lang.String |
KEY_POOL_URL
Key for pool url.
|
static java.lang.String |
KEY_POOL_USER
Key for pool user.
|
static java.lang.String |
KEY_POOL_VFS
Key for vfs pool.
|
static java.lang.String |
KEY_USERNAME
Key for user name.
|
static java.lang.String |
OPENCMS_DEFAULT_POOL_NAME
The name of the opencms default pool.
|
static java.lang.String |
OPENCMS_DEFAULT_POOL_URL
The default OpenCms JDBC pool URL.
|
static java.lang.String |
OPENCMS_URL_PREFIX
The prefix used for opencms JDBC pools.
|
Constructor and Description |
---|
CmsDbPoolV11(CmsParameterConfiguration config,
java.lang.String key)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the pool.
|
static com.zaxxer.hikari.HikariConfig |
createHikariConfig(CmsParameterConfiguration config,
java.lang.String key)
Creates the HikariCP configuration based on the configuration of a pool defined in opencms.properties.
|
int |
getActiveConnections()
Returns the number of active connections.
|
java.sql.Connection |
getConnection()
Gets a database connection from the pool.
|
static java.lang.String |
getDefaultDbPoolName()
Returns the name of the default database connection pool.
|
int |
getIdleConnections()
Gets the number of idle connections.
|
java.lang.String |
getPoolUrl()
Gets the pool url.
|
static java.lang.String |
getPropertyRelativeSuffix(java.lang.String prefix,
java.lang.String str)
If str starts with prefix + '
|
public static final java.lang.String KEY_DATABASE
public static final java.lang.String KEY_DATABASE_NAME
public static final java.lang.String KEY_DATABASE_POOL
public static final java.lang.String KEY_CONNECT_ATTEMTS
public static final java.lang.String KEY_CONNECT_WAITS
public static final java.lang.String KEY_ENTITY_MANAGER_POOL_SIZE
public static final java.lang.String KEY_JDBC_DRIVER
public static final java.lang.String KEY_JDBC_URL
public static final java.lang.String KEY_JDBC_URL_PARAMS
public static final java.lang.String KEY_PASSWORD
public static final java.lang.String KEY_POOL_DEFAULT
public static final java.lang.String KEY_POOL_URL
public static final java.lang.String KEY_POOL_USER
public static final java.lang.String KEY_POOL_VFS
public static final java.lang.String KEY_USERNAME
public static final java.lang.String OPENCMS_DEFAULT_POOL_NAME
public static final java.lang.String OPENCMS_DEFAULT_POOL_URL
public static final java.lang.String OPENCMS_URL_PREFIX
public CmsDbPoolV11(CmsParameterConfiguration config, java.lang.String key) throws java.lang.Exception
config
- the OpenCms configuration (opencms.properties)key
- the name of the pool (without the opencms: prefix)java.lang.Exception
- if something goes wrongpublic static com.zaxxer.hikari.HikariConfig createHikariConfig(CmsParameterConfiguration config, java.lang.String key)
config
- the configuration object with the propertieskey
- the pool name (without the opencms prefix)public static java.lang.String getDefaultDbPoolName()
public static java.lang.String getPropertyRelativeSuffix(java.lang.String prefix, java.lang.String str)
prefix
- the prefixstr
- the string to remove the prefix frompublic void close() throws java.lang.Exception
java.lang.Exception
- if something goes wrongpublic int getActiveConnections()
public java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
- if something goes wrongpublic int getIdleConnections()
public java.lang.String getPoolUrl()