Class HbaseConnectionFactory


  • public class HbaseConnectionFactory
    extends Object
    Creates and Caches HBase Connection Instances, using the connection string as the cache key.
    • Constructor Detail

      • HbaseConnectionFactory

        public HbaseConnectionFactory()
    • 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 HBaseConnection 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,
                                     HBaseConnection 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.