Class HbaseConnectionFactory
- java.lang.Object
-
- com.amazonaws.athena.connectors.hbase.HbaseConnectionFactory
-
public class HbaseConnectionFactory extends Object
Creates and Caches HBase Connection Instances, using the connection string as the cache key.
-
-
Constructor Summary
Constructors Constructor Description HbaseConnectionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddConnection(String conStr, org.apache.hadoop.hbase.client.Connection conn)Injects a connection into the client cache.Map<String,String>getClientConfigs()Provides access to the current HBase client config options used during connection construction.org.apache.hadoop.hbase.client.ConnectiongetOrCreateConn(String conStr)Gets or Creates an HBase connection for the given connection string.voidsetClientConfig(String name, String value)Used to set HBase client config options that should be applied to all future connections.
-
-
-
Method Detail
-
setClientConfig
public void setClientConfig(String name, String value)
Used to set HBase client config options that should be applied to all future connections.- Parameters:
name- The name of the property (e.g. hbase.rpc.timeout).value- The value of the property to set on the HBase client config object before construction.
-
getClientConfigs
public Map<String,String> getClientConfigs()
Provides access to the current HBase client config options used during connection construction.- Returns:
- Map
where the Key is the config name and the value is the config value.
-
getOrCreateConn
public org.apache.hadoop.hbase.client.Connection getOrCreateConn(String conStr)
Gets or Creates an HBase connection for the given connection string.- Parameters:
conStr- HBase connection details, format is expected to be host:master_port:zookeeper_port- Returns:
- An HBase connection if the connection succeeded, else the function will throw.
-
addConnection
protected void addConnection(String conStr, org.apache.hadoop.hbase.client.Connection conn)
Injects a connection into the client cache.- Parameters:
conStr- The connection string (aka the cache key)conn- The connection to inject into the client cache, most often a Mock used in testing.
-
-