public class HiveClientFactoryBean extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<HiveClientFactory>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
HiveClient
using a JdbcTemplate
.
The HiveClient class is not thread-safe. We use a SingleConnectionDataSource
to hold on to a connection for
the duration of the client. This means that all operations while happen in the same session. This is important when
setting properties on the session.
Note that the caller needs to handle the object clean-up, specifically calling HiveClient.shutdown()
.
In general, to avoid leaks it is recommended to use the HiveTemplate
.Constructor and Description |
---|
HiveClientFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected HiveClient |
createHiveClient() |
void |
destroy() |
HiveClientFactory |
getObject() |
java.lang.Class<?> |
getObjectType() |
int |
getPhase() |
boolean |
isSingleton() |
void |
setHiveDataSource(javax.sql.DataSource dataSource)
Sets the DataSource.
|
void |
setScripts(java.util.Collection<HiveScript> scripts)
Sets the scripts to execute once the client connects.
|
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void destroy() throws java.lang.Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
java.lang.Exception
public HiveClientFactory getObject()
getObject
in interface org.springframework.beans.factory.FactoryBean<HiveClientFactory>
public java.lang.Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<HiveClientFactory>
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<HiveClientFactory>
protected HiveClient createHiveClient()
public int getPhase()
public void setHiveDataSource(javax.sql.DataSource dataSource)
dataSource
- The DataSource.public void setScripts(java.util.Collection<HiveScript> scripts)
scripts
- The scripts to set.