Package org.apache.hadoop.hbase.client
Class ConnectionRegistryFactory
java.lang.Object
org.apache.hadoop.hbase.client.ConnectionRegistryFactory
The entry point for creating a
ConnectionRegistry
.-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<String,
ConnectionRegistryURIFactory> private static final org.slf4j.Logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) static ConnectionRegistry
Returns the connection registry implementation to use, for the given connection urluri
.(package private) static ConnectionRegistry
Returns the connection registry implementation to use.static URI
tryParseAsConnectionURI
(String clusterKey) static void
Check whether the givenuri
is valid.
-
Field Details
-
LOG
-
FACTORIES
private static final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<String,ConnectionRegistryURIFactory> FACTORIES
-
-
Constructor Details
-
ConnectionRegistryFactory
private ConnectionRegistryFactory()
-
-
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 urluri
. We useServiceLoader
to load different implementations, and use the scheme of the givenuri
to select. And if there is no protocol specified, or we can not find aConnectionRegistryURIFactory
implementation for the given scheme, we will fallback to use the old way to create theConnectionRegistry
. Notice that, if fallback happens, the specified connection urluri
will not take effect, we will load all the related configurations from the given Configuration instanceconf
- Throws:
IOException
-
create
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
Check whether the givenuri
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
If the givenclusterKey
can be parsed to aURI
, and the scheme of theURI
is supported by us, return theURI
, otherwise returnnull
.- Parameters:
clusterKey
- the cluster key, typically from replication peer config- Returns:
- a
URI
ornull
.
-