@RequiresInstanceClassLoading @Tags(value={"dbcp","hikari","jdbc","database","connection","pooling","store"}) @CapabilityDescription(value="Provides Database Connection Pooling Service based on HikariCP. Connections can be asked from pool and returned after usage.") @SupportsSensitiveDynamicProperties @DynamicProperty(name="JDBC property name", value="JDBC property value", expressionLanguageScope=VARIABLE_REGISTRY, description="Specifies a property name and value to be set on the JDBC connection(s). If Expression Language is used, evaluation will be performed upon the controller service being enabled. Note that no flow file input (attributes, e.g.) is available for use in Expression Language constructs for these properties.") public class HikariCPConnectionPool extends AbstractControllerService implements DBCPService
| Modifier and Type | Field and Description |
|---|---|
static PropertyDescriptor |
DATABASE_URL |
private com.zaxxer.hikari.HikariDataSource |
dataSource |
static PropertyDescriptor |
DB_DRIVER_LOCATION |
static PropertyDescriptor |
DB_DRIVERNAME |
static PropertyDescriptor |
DB_PASSWORD |
static PropertyDescriptor |
DB_USER |
private static String |
DEFAULT_MAX_CONN_LIFETIME |
private static String |
DEFAULT_TOTAL_CONNECTIONS |
protected static long |
INFINITE_MILLISECONDS |
static PropertyDescriptor |
KERBEROS_USER_SERVICE |
private KerberosUser |
kerberosUser |
static PropertyDescriptor |
MAX_CONN_LIFETIME |
static PropertyDescriptor |
MAX_TOTAL_CONNECTIONS |
static PropertyDescriptor |
MAX_WAIT_TIME |
static PropertyDescriptor |
MIN_IDLE |
private static List<PropertyDescriptor> |
properties |
protected static String |
SENSITIVE_PROPERTY_PREFIX
Property Name Prefix for Sensitive Dynamic Properties
|
static PropertyDescriptor |
VALIDATION_QUERY |
| Constructor and Description |
|---|
HikariCPConnectionPool() |
| Modifier and Type | Method and Description |
|---|---|
private long |
extractMillisWithInfinite(PropertyValue prop) |
Connection |
getConnection() |
(package private) com.zaxxer.hikari.HikariDataSource |
getDataSource() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
void |
onConfigured(ConfigurationContext context)
Configures connection pool by creating an instance of the
HikariDataSource based on configuration provided with
ConfigurationContext. |
void |
shutdown()
Shutdown pool, close all open connections.
|
String |
toString() |
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabledcustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetConnection, getFlowFileFilter, getFlowFileFilterinitialize, isStatefulgetIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprotected static final String SENSITIVE_PROPERTY_PREFIX
protected static final long INFINITE_MILLISECONDS
private static final String DEFAULT_TOTAL_CONNECTIONS
private static final String DEFAULT_MAX_CONN_LIFETIME
public static final PropertyDescriptor DATABASE_URL
public static final PropertyDescriptor DB_DRIVERNAME
public static final PropertyDescriptor DB_DRIVER_LOCATION
public static final PropertyDescriptor DB_USER
public static final PropertyDescriptor DB_PASSWORD
public static final PropertyDescriptor MAX_WAIT_TIME
public static final PropertyDescriptor MAX_TOTAL_CONNECTIONS
public static final PropertyDescriptor VALIDATION_QUERY
public static final PropertyDescriptor MIN_IDLE
public static final PropertyDescriptor MAX_CONN_LIFETIME
public static final PropertyDescriptor KERBEROS_USER_SERVICE
private static final List<PropertyDescriptor> properties
private volatile com.zaxxer.hikari.HikariDataSource dataSource
private volatile KerberosUser kerberosUser
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponent@OnEnabled public void onConfigured(ConfigurationContext context)
HikariDataSource based on configuration provided with
ConfigurationContext.
This operation makes no guarantees that the actual connection could be made since the underlying system may still go off-line during normal operation of the connection pool.
context - the configuration contextprivate long extractMillisWithInfinite(PropertyValue prop)
@OnDisabled public void shutdown()
If a @LoginException occurs while attempting to log out the @KerberosUser,
an attempt will still be made to shut down the pool and close open connections.
public Connection getConnection() throws ProcessException
getConnection in interface DBCPServiceProcessExceptionpublic String toString()
toString in class AbstractConfigurableComponentcom.zaxxer.hikari.HikariDataSource getDataSource()
Copyright © 2022 Apache NiFi Project. All rights reserved.