Package org.apache.nifi.dbcp
Class HikariCPConnectionPool
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.controller.AbstractControllerService
org.apache.nifi.dbcp.HikariCPConnectionPool
- All Implemented Interfaces:
ConfigurableComponent,ControllerService,DBCPService
@RequiresInstanceClassLoading
@Tags({"dbcp","hikari","jdbc","database","connection","pooling","store"})
@CapabilityDescription("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=ENVIRONMENT,
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.")
@Restricted(restrictions=@Restriction(requiredPermission=REFERENCE_REMOTE_RESOURCES,explanation="Database Driver Location can reference resources over HTTP"))
public class HikariCPConnectionPool
extends AbstractControllerService
implements DBCPService
Implementation of Database Connection Pooling Service. HikariCP is used for connection pooling functionality.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyDescriptorprivate com.zaxxer.hikari.HikariDataSourcestatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorprivate static final Stringprivate static final Stringprotected static final longstatic final PropertyDescriptorprivate KerberosUserstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptorprivate static final List<PropertyDescriptor> protected static final StringProperty Name Prefix for Sensitive Dynamic Propertiesstatic final PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate long(package private) com.zaxxer.hikari.HikariDataSourceprotected PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) protected List<PropertyDescriptor> voidonConfigured(ConfigurationContext context) Configures connection pool by creating an instance of theHikariDataSourcebased on configuration provided withConfigurationContext.voidshutdown()Shutdown pool, close all open connections.toString()Methods inherited from class org.apache.nifi.controller.AbstractControllerService
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabledMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.controller.ControllerService
initialize, isStateful, migratePropertiesMethods inherited from interface org.apache.nifi.dbcp.DBCPService
getConnection, getFlowFileFilter, getFlowFileFilter
-
Field Details
-
SENSITIVE_PROPERTY_PREFIX
Property Name Prefix for Sensitive Dynamic Properties- See Also:
-
INFINITE_MILLISECONDS
protected static final long INFINITE_MILLISECONDS- See Also:
-
DEFAULT_TOTAL_CONNECTIONS
- See Also:
-
DEFAULT_MAX_CONN_LIFETIME
- See Also:
-
DATABASE_URL
-
DB_DRIVERNAME
-
DB_DRIVER_LOCATION
-
DB_USER
-
DB_PASSWORD
-
MAX_WAIT_TIME
-
MAX_TOTAL_CONNECTIONS
-
VALIDATION_QUERY
-
MIN_IDLE
-
MAX_CONN_LIFETIME
-
KERBEROS_USER_SERVICE
-
properties
-
dataSource
private volatile com.zaxxer.hikari.HikariDataSource dataSource -
kerberosUser
-
-
Constructor Details
-
HikariCPConnectionPool
public HikariCPConnectionPool()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classAbstractConfigurableComponent
-
getSupportedDynamicPropertyDescriptor
- Overrides:
getSupportedDynamicPropertyDescriptorin classAbstractConfigurableComponent
-
onConfigured
Configures connection pool by creating an instance of theHikariDataSourcebased on configuration provided withConfigurationContext.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.
- Parameters:
context- the configuration context
-
extractMillisWithInfinite
-
shutdown
Shutdown pool, close all open connections. If a principal is authenticated with a KDC, that principal is logged out.If a @
LoginExceptionoccurs while attempting to log out the @KerberosUser, an attempt will still be made to shut down the pool and close open connections. -
getConnection
- Specified by:
getConnectionin interfaceDBCPService- Throws:
ProcessException
-
toString
- Overrides:
toStringin classAbstractConfigurableComponent
-
getDataSource
com.zaxxer.hikari.HikariDataSource getDataSource()
-