Class ConnectionRegistryFactory

java.lang.Object
org.apache.hadoop.hbase.client.ConnectionRegistryFactory

@Private public final class ConnectionRegistryFactory extends Object
The entry point for creating a ConnectionRegistry.
  • Field Details

  • Constructor Details

  • Method Details

    • create

      static ConnectionRegistry create(URI uri, org.apache.hadoop.conf.Configuration conf, User user) throws IOException
      Returns the connection registry implementation to use, for the given connection url uri.

      We use ServiceLoader to load different implementations, and use the scheme of the given uri to select. And if there is no protocol specified, or we can not find a ConnectionRegistryURIFactory implementation for the given scheme, we will fallback to use the old way to create the ConnectionRegistry. Notice that, if fallback happens, the specified connection url uri will not take effect, we will load all the related configurations from the given Configuration instance conf

      Throws:
      IOException
    • create

      static ConnectionRegistry create(org.apache.hadoop.conf.Configuration conf, User user)
      Returns the connection registry implementation to use.

      This is used when we do not have a connection url, we will use the old way to load the connection registry, by checking the HConstants#CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY configuration.

    • validate

      public static void validate(URI uri) throws IOException
      Check whether the given uri is valid.

      Notice that there is no fallback logic for this method, so passing an URI with null scheme can not pass.

      Throws:
      IOException - if this is not a valid connection registry URI
    • tryParseAsConnectionURI

      public static URI tryParseAsConnectionURI(String clusterKey)
      If the given clusterKey can be parsed to a URI, and the scheme of the URI is supported by us, return the URI, otherwise return null.
      Parameters:
      clusterKey - the cluster key, typically from replication peer config
      Returns:
      a URI or null.