public abstract class AbstractDBCPConnectionPool extends AbstractControllerService implements DBCPService, VerifiableControllerService
| Modifier and Type | Field and Description |
|---|---|
static PropertyDescriptor |
DATABASE_URL |
protected org.apache.commons.dbcp2.BasicDataSource |
dataSource |
static PropertyDescriptor |
DB_DRIVER_LOCATION |
static PropertyDescriptor |
DB_DRIVERNAME |
static PropertyDescriptor |
DB_PASSWORD |
static PropertyDescriptor |
DB_USER |
private static String |
DEFAULT_EVICTION_RUN_PERIOD
Copied from
BaseObjectPoolConfig.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS in Commons-DBCP 2.7.0 |
private static String |
DEFAULT_MAX_CONN_LIFETIME
Copied from private variable
BasicDataSource.maxConnLifetimeMillis in Commons-DBCP 2.7.0 |
private static String |
DEFAULT_MAX_IDLE
Copied from
GenericObjectPoolConfig.DEFAULT_MAX_IDLE in Commons-DBCP 2.7.0 |
private static String |
DEFAULT_MIN_EVICTABLE_IDLE_TIME
Copied from
BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS in Commons-DBCP 2.7.0
and converted from 1800000L to "1800000 millis" to "30 mins" |
private static String |
DEFAULT_MIN_IDLE
Copied from
GenericObjectPoolConfig.DEFAULT_MIN_IDLE in Commons-DBCP 2.7.0 |
private static String |
DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME
Copied from
BaseObjectPoolConfig.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS in Commons-DBCP 2.7.0 |
static PropertyDescriptor |
EVICTION_RUN_PERIOD |
static PropertyDescriptor |
KERBEROS_CREDENTIALS_SERVICE |
static PropertyDescriptor |
KERBEROS_PASSWORD |
static PropertyDescriptor |
KERBEROS_PRINCIPAL |
static PropertyDescriptor |
KERBEROS_USER_SERVICE |
protected KerberosUser |
kerberosUser |
static PropertyDescriptor |
MAX_CONN_LIFETIME |
static PropertyDescriptor |
MAX_IDLE |
static PropertyDescriptor |
MAX_TOTAL_CONNECTIONS |
static PropertyDescriptor |
MAX_WAIT_TIME |
static PropertyDescriptor |
MIN_EVICTABLE_IDLE_TIME |
static PropertyDescriptor |
MIN_IDLE |
protected static String |
SENSITIVE_PROPERTY_PREFIX
Property Name Prefix for Sensitive Dynamic Properties
|
static PropertyDescriptor |
SOFT_MIN_EVICTABLE_IDLE_TIME |
static PropertyDescriptor |
VALIDATION_QUERY |
| Constructor and Description |
|---|
AbstractDBCPConnectionPool() |
| Modifier and Type | Method and Description |
|---|---|
private void |
configureDataSource(org.apache.commons.dbcp2.BasicDataSource dataSource,
KerberosUser kerberosUser,
ConfigurationContext context) |
protected Long |
extractMillisWithInfinite(PropertyValue prop) |
Connection |
getConnection() |
private Connection |
getConnection(org.apache.commons.dbcp2.BasicDataSource dataSource,
KerberosUser kerberosUser) |
protected Map<String,String> |
getConnectionProperties(ConfigurationContext context)
Override in subclasses to provide connection properties to the data source
|
protected Driver |
getDriver(String driverName,
String url) |
private KerberosUser |
getKerberosUser(ConfigurationContext context) |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected String |
getUrl(ConfigurationContext context) |
void |
onConfigured(ConfigurationContext context)
Configures connection pool by creating an instance of the
BasicDataSource based on configuration provided with
ConfigurationContext. |
void |
shutdown()
Shutdown pool, close all open connections.
|
private void |
shutdown(org.apache.commons.dbcp2.BasicDataSource dataSource,
KerberosUser kerberosUser) |
String |
toString() |
List<ConfigVerificationResult> |
verify(ConfigurationContext context,
ComponentLog verificationLogger,
Map<String,String> variables) |
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabledcustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetConnection, getFlowFileFilter, getFlowFileFilterinitialize, isStatefulgetIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprotected static final String SENSITIVE_PROPERTY_PREFIX
private static final String DEFAULT_MIN_IDLE
GenericObjectPoolConfig.DEFAULT_MIN_IDLE in Commons-DBCP 2.7.0private static final String DEFAULT_MAX_IDLE
GenericObjectPoolConfig.DEFAULT_MAX_IDLE in Commons-DBCP 2.7.0private static final String DEFAULT_MAX_CONN_LIFETIME
BasicDataSource.maxConnLifetimeMillis in Commons-DBCP 2.7.0private static final String DEFAULT_EVICTION_RUN_PERIOD
BaseObjectPoolConfig.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS in Commons-DBCP 2.7.0private static final String DEFAULT_MIN_EVICTABLE_IDLE_TIME
BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS in Commons-DBCP 2.7.0
and converted from 1800000L to "1800000 millis" to "30 mins"private static final String DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME
BaseObjectPoolConfig.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS in Commons-DBCP 2.7.0public 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_IDLE
public static final PropertyDescriptor MAX_CONN_LIFETIME
public static final PropertyDescriptor EVICTION_RUN_PERIOD
public static final PropertyDescriptor MIN_EVICTABLE_IDLE_TIME
public static final PropertyDescriptor SOFT_MIN_EVICTABLE_IDLE_TIME
public static final PropertyDescriptor KERBEROS_CREDENTIALS_SERVICE
public static final PropertyDescriptor KERBEROS_USER_SERVICE
public static final PropertyDescriptor KERBEROS_PRINCIPAL
public static final PropertyDescriptor KERBEROS_PASSWORD
protected volatile org.apache.commons.dbcp2.BasicDataSource dataSource
protected volatile KerberosUser kerberosUser
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentpublic List<ConfigVerificationResult> verify(ConfigurationContext context, ComponentLog verificationLogger, Map<String,String> variables)
verify in interface VerifiableControllerService@OnEnabled public void onConfigured(ConfigurationContext context) throws InitializationException
BasicDataSource 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 contextInitializationException - if unable to create a database connectionprivate void configureDataSource(org.apache.commons.dbcp2.BasicDataSource dataSource,
KerberosUser kerberosUser,
ConfigurationContext context)
throws InitializationException
InitializationExceptionprivate KerberosUser getKerberosUser(ConfigurationContext context)
protected String getUrl(ConfigurationContext context)
protected Map<String,String> getConnectionProperties(ConfigurationContext context)
protected Long extractMillisWithInfinite(PropertyValue prop)
@OnDisabled public void shutdown() throws SQLException
LoginException occurs while attempting to log out the @KerberosUser,
an attempt will still be made to shut down the pool and close open connections.SQLException - if there is an error while closing open connectionsLoginException - if there is an error during the principal log out, and will only be thrown if there was
no exception while closing open connectionsprivate void shutdown(org.apache.commons.dbcp2.BasicDataSource dataSource,
KerberosUser kerberosUser)
throws SQLException
SQLExceptionpublic Connection getConnection() throws ProcessException
getConnection in interface DBCPServiceProcessExceptionprivate Connection getConnection(org.apache.commons.dbcp2.BasicDataSource dataSource, KerberosUser kerberosUser)
public String toString()
toString in class AbstractConfigurableComponentCopyright © 2023 Apache NiFi Project. All rights reserved.