@RequiresInstanceClassLoading @Tags(value={"hive","dbcp","jdbc","database","connection","pooling","store"}) @CapabilityDescription(value="Provides Database Connection Pooling Service for Apache Hive. Connections can be asked from pool and returned after usage.") public class HiveConnectionPool extends AbstractControllerService implements HiveDBCPService
Modifier and Type | Field and Description |
---|---|
static PropertyDescriptor |
DATABASE_URL |
static PropertyDescriptor |
DB_PASSWORD |
static PropertyDescriptor |
DB_USER |
static PropertyDescriptor |
HIVE_CONFIGURATION_RESOURCES |
static PropertyDescriptor |
MAX_TOTAL_CONNECTIONS |
static PropertyDescriptor |
MAX_WAIT_TIME |
static PropertyDescriptor |
VALIDATION_QUERY |
Constructor and Description |
---|
HiveConnectionPool() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Collection<ValidationResult> |
customValidate(ValidationContext validationContext)
Allows subclasses to perform their own validation on the already set
properties.
|
java.sql.Connection |
getConnection() |
java.lang.String |
getConnectionURL() |
protected java.util.List<PropertyDescriptor> |
getSupportedPropertyDescriptors()
Allows subclasses to register which property descriptor objects are
supported.
|
protected void |
init(ControllerServiceInitializationContext context)
Provides a mechanism by which subclasses can perform initialization of
the Controller Service before it is scheduled to be run
|
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.
|
java.lang.String |
toString() |
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getProperty, getStateManager, initialize, isEnabled
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
initialize
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
public static final PropertyDescriptor DATABASE_URL
public static final PropertyDescriptor HIVE_CONFIGURATION_RESOURCES
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
protected void init(ControllerServiceInitializationContext context)
AbstractControllerService
init
in class AbstractControllerService
context
- of initialization contextprotected java.util.List<PropertyDescriptor> getSupportedPropertyDescriptors()
AbstractConfigurableComponent
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
protected java.util.Collection<ValidationResult> customValidate(ValidationContext validationContext)
AbstractConfigurableComponent
customValidate
in class AbstractConfigurableComponent
validationContext
- provides a mechanism for obtaining externally
managed values, such as property values and supplies convenience methods
for operating on those values@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 connection@OnDisabled public void shutdown()
public java.sql.Connection getConnection() throws ProcessException
getConnection
in interface DBCPService
ProcessException
public java.lang.String toString()
toString
in class AbstractConfigurableComponent
public java.lang.String getConnectionURL()
getConnectionURL
in interface HiveDBCPService