@InterfaceAudience.Private class ZKConnectionRegistry extends Object implements ConnectionRegistry
Modifier and Type | Class and Description |
---|---|
private static interface |
ZKConnectionRegistry.Converter<T> |
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private ReadOnlyZKClient |
zk |
private ZNodePaths |
znodePaths |
Constructor and Description |
---|
ZKConnectionRegistry(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this instance and releases any system resources associated with it
|
CompletableFuture<ServerName> |
getActiveMaster()
Get the address of active HMaster.
|
private <T> CompletableFuture<T> |
getAndConvert(String path,
ZKConnectionRegistry.Converter<T> converter) |
CompletableFuture<String> |
getClusterId()
Should only be called once.
|
private static String |
getClusterId(byte[] data) |
String |
getConnectionString()
Return the connection string associated with this registry instance.
|
private static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.Master |
getMasterProto(byte[] data) |
private static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.MetaRegionServer |
getMetaProto(byte[] data) |
private void |
getMetaRegionLocation(CompletableFuture<RegionLocations> future,
List<String> metaReplicaZNodes) |
CompletableFuture<RegionLocations> |
getMetaRegionLocations()
Get the location of meta region(s).
|
private Pair<RegionState.State,ServerName> |
getStateAndServerName(org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.MetaRegionServer proto) |
(package private) ReadOnlyZKClient |
getZKClient() |
private static void |
tryComplete(org.apache.commons.lang3.mutable.MutableInt remaining,
Collection<HRegionLocation> locs,
CompletableFuture<RegionLocations> future) |
private static final org.slf4j.Logger LOG
private final ReadOnlyZKClient zk
private final ZNodePaths znodePaths
ZKConnectionRegistry(org.apache.hadoop.conf.Configuration conf)
private <T> CompletableFuture<T> getAndConvert(String path, ZKConnectionRegistry.Converter<T> converter)
private static String getClusterId(byte[] data) throws DeserializationException
DeserializationException
public CompletableFuture<String> getClusterId()
ConnectionRegistry
The upper layer should store this value somewhere as it will not be change any more.
getClusterId
in interface ConnectionRegistry
ReadOnlyZKClient getZKClient()
private static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.MetaRegionServer getMetaProto(byte[] data) throws IOException
IOException
private static void tryComplete(org.apache.commons.lang3.mutable.MutableInt remaining, Collection<HRegionLocation> locs, CompletableFuture<RegionLocations> future)
private Pair<RegionState.State,ServerName> getStateAndServerName(org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.MetaRegionServer proto)
private void getMetaRegionLocation(CompletableFuture<RegionLocations> future, List<String> metaReplicaZNodes)
public CompletableFuture<RegionLocations> getMetaRegionLocations()
ConnectionRegistry
getMetaRegionLocations
in interface ConnectionRegistry
private static org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.Master getMasterProto(byte[] data) throws IOException
IOException
public CompletableFuture<ServerName> getActiveMaster()
ConnectionRegistry
getActiveMaster
in interface ConnectionRegistry
public String getConnectionString()
ConnectionRegistry
getConnectionString
in interface ConnectionRegistry
public void close()
ConnectionRegistry
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ConnectionRegistry
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.