Package org.apache.hadoop.hbase.client
Class AsyncConnectionImpl
java.lang.Object
org.apache.hadoop.hbase.client.AsyncConnectionImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,AsyncConnection
- Direct Known Subclasses:
AsyncClusterConnectionImpl
The implementation of AsyncConnection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<String,org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.Interface> private final ClientBackoffPolicy(package private) final AsyncRpcRetryingCallerFactoryprivate ChoreServiceprivate final AtomicBooleanprivate final ClusterStatusListenerprivate final org.apache.hadoop.conf.Configurationprivate ConnectionOverAsyncConnection(package private) final AsyncConnectionConfigurationprivate final AsyncRegionLocatorprivate static final org.slf4j.Loggerprivate final AtomicReference<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface>private final AtomicReference<CompletableFuture<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface>>private final Optional<MetricsConnection>private final Stringprivate final NonceGenerator(package private) final ConnectionRegistry(package private) static final org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimerprotected final RpcClient(package private) final RpcControllerFactoryprotected final intprivate final ConcurrentMap<String,org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface> private final Optional<ServerStatisticTracker>protected final User -
Constructor Summary
ConstructorsConstructorDescriptionAsyncConnectionImpl(org.apache.hadoop.conf.Configuration conf, ConnectionRegistry registry, String clusterId, SocketAddress localAddress, User user) AsyncConnectionImpl(org.apache.hadoop.conf.Configuration conf, ConnectionRegistry registry, String clusterId, SocketAddress localAddress, User user, Map<String, byte[]> connectionAttributes) -
Method Summary
Modifier and TypeMethodDescription(package private) voidclearMasterStubCache(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface stub) voidClear all the entries in the region location cache, for all the tables.voidclose()private org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.InterfacecreateAdminServerStub(ServerName serverName) private org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.InterfacecreateMasterStub(ServerName serverName) private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.InterfacecreateRegionServerStub(ServerName serverName) Returns anAsyncAdminBuilderfor creatingAsyncAdmin.Returns anAsyncAdminBuilderfor creatingAsyncAdmin.(package private) org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.InterfacegetAdminStub(ServerName serverName) (package private) ClientBackoffPolicygetBufferedMutatorBuilder(TableName tableName) Returns anAsyncBufferedMutatorBuilderfor creatingAsyncBufferedMutator.getBufferedMutatorBuilder(TableName tableName, ExecutorService pool) Returns anAsyncBufferedMutatorBuilderfor creatingAsyncBufferedMutator.(package private) ChoreServiceIf choreService has not been created yet, create the ChoreService.(package private) Stringorg.apache.hadoop.conf.ConfigurationReturns theConfigurationobject used by this instance.(package private) Optional<MetricsConnection>getHbck()Retrieve an Hbck implementation to fix an HBase cluster.getHbck(ServerName masterServer) Retrieve an Hbck implementation to fix an HBase cluster.private HbckgetHbckInternal(ServerName masterServer) (package private) AsyncRegionLocator(package private) CompletableFuture<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface>(package private) NonceGeneratorgetRegionLocator(TableName tableName) Retrieve a AsyncRegionLocator implementation to inspect region information on a table.(package private) org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.InterfacegetRegionServerStub(ServerName serverName) (package private) Optional<ServerStatisticTracker>getTableBuilder(TableName tableName) Returns anAsyncTableBuilderfor creatingAsyncTable.getTableBuilder(TableName tableName, ExecutorService pool) Returns anAsyncTableBuilderfor creatingAsyncTable.getUser()booleanisClosed()Returns whether the connection is closed or not.private voidlogCallStack(StackTraceElement[] stackTraceElements) private voidspawnRenewalChore(org.apache.hadoop.security.UserGroupInformation user) Convert this connection to aConnection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.client.AsyncConnection
getAdmin, getAdmin, getBufferedMutator, getBufferedMutator, getTable, getTable
-
Field Details
-
LOG
-
RETRY_TIMER
-
conf
-
connConf
-
user
-
registry
-
rpcTimeout
-
rpcClient
-
rpcControllerFactory
-
locator
-
callerFactory
-
nonceGenerator
-
rsStubs
private final ConcurrentMap<String,org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface> rsStubs -
adminStubs
private final ConcurrentMap<String,org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.Interface> adminStubs -
masterStub
private final AtomicReference<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface> masterStub -
masterStubMakeFuture
private final AtomicReference<CompletableFuture<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface>> masterStubMakeFuture -
stats
-
backoffPolicy
-
choreService
-
closed
-
metricsScope
-
metrics
-
clusterStatusListener
-
conn
-
-
Constructor Details
-
AsyncConnectionImpl
public AsyncConnectionImpl(org.apache.hadoop.conf.Configuration conf, ConnectionRegistry registry, String clusterId, SocketAddress localAddress, User user) -
AsyncConnectionImpl
public AsyncConnectionImpl(org.apache.hadoop.conf.Configuration conf, ConnectionRegistry registry, String clusterId, SocketAddress localAddress, User user, Map<String, byte[]> connectionAttributes)
-
-
Method Details
-
spawnRenewalChore
-
getChoreService
If choreService has not been created yet, create the ChoreService. -
getUser
-
getConnectionRegistry
-
getConfiguration
Description copied from interface:AsyncConnectionReturns theConfigurationobject used by this instance.The reference returned is not a copy, so any change made to it will affect this instance.
- Specified by:
getConfigurationin interfaceAsyncConnection
-
isClosed
Description copied from interface:AsyncConnectionReturns whether the connection is closed or not.- Specified by:
isClosedin interfaceAsyncConnection- Returns:
- true if this connection is closed
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
logCallStack
-
getRegionLocator
Description copied from interface:AsyncConnectionRetrieve a AsyncRegionLocator implementation to inspect region information on a table. The returned AsyncRegionLocator is not thread-safe, so a new instance should be created for each using thread. This is a lightweight operation. Pooling or caching of the returned AsyncRegionLocator is neither required nor desired.- Specified by:
getRegionLocatorin interfaceAsyncConnection- Parameters:
tableName- Name of the table who's region is to be examined- Returns:
- An AsyncRegionLocator instance
-
clearRegionLocationCache
Description copied from interface:AsyncConnectionClear all the entries in the region location cache, for all the tables. If you only want to clear the cache for a specific table, useAsyncTableRegionLocator.clearRegionLocationCache(). This may cause performance issue so use it with caution.- Specified by:
clearRegionLocationCachein interfaceAsyncConnection
-
getLocator
-
getNonceGenerator
-
createRegionServerStub
private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface createRegionServerStub(ServerName serverName) throws IOException - Throws:
IOException
-
getRegionServerStub
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface getRegionServerStub(ServerName serverName) throws IOException - Throws:
IOException
-
createMasterStub
private org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface createMasterStub(ServerName serverName) throws IOException - Throws:
IOException
-
createAdminServerStub
private org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.Interface createAdminServerStub(ServerName serverName) throws IOException - Throws:
IOException
-
getAdminStub
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.Interface getAdminStub(ServerName serverName) throws IOException - Throws:
IOException
-
getMasterStub
CompletableFuture<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface> getMasterStub() -
getClusterId
-
clearMasterStubCache
void clearMasterStubCache(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface stub) -
getStatisticsTracker
-
getBackoffPolicy
-
getTableBuilder
Description copied from interface:AsyncConnectionReturns anAsyncTableBuilderfor creatingAsyncTable.This method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.
- Specified by:
getTableBuilderin interfaceAsyncConnection- Parameters:
tableName- the name of the table
-
getTableBuilder
public AsyncTableBuilder<ScanResultConsumer> getTableBuilder(TableName tableName, ExecutorService pool) Description copied from interface:AsyncConnectionReturns anAsyncTableBuilderfor creatingAsyncTable.This method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.
- Specified by:
getTableBuilderin interfaceAsyncConnection- Parameters:
tableName- the name of the tablepool- the thread pool to use for executing callback
-
getAdminBuilder
Description copied from interface:AsyncConnectionReturns anAsyncAdminBuilderfor creatingAsyncAdmin.The admin operation's returned
CompletableFuturewill be finished directly in the rpc framework's callback thread, so typically you should not do any time consuming work inside these methods.- Specified by:
getAdminBuilderin interfaceAsyncConnection
-
getAdminBuilder
Description copied from interface:AsyncConnectionReturns anAsyncAdminBuilderfor creatingAsyncAdmin.- Specified by:
getAdminBuilderin interfaceAsyncConnection- Parameters:
pool- the thread pool to use for executing callback
-
getBufferedMutatorBuilder
Description copied from interface:AsyncConnectionReturns anAsyncBufferedMutatorBuilderfor creatingAsyncBufferedMutator.- Specified by:
getBufferedMutatorBuilderin interfaceAsyncConnection- Parameters:
tableName- the name of the table
-
getBufferedMutatorBuilder
public AsyncBufferedMutatorBuilder getBufferedMutatorBuilder(TableName tableName, ExecutorService pool) Description copied from interface:AsyncConnectionReturns anAsyncBufferedMutatorBuilderfor creatingAsyncBufferedMutator.- Specified by:
getBufferedMutatorBuilderin interfaceAsyncConnection- Parameters:
tableName- the name of the tablepool- the thread pool to use for executing callback
-
toConnection
Description copied from interface:AsyncConnectionConvert this connection to aConnection. Usually we will return the same instance if you call this method multiple times so you can consider this as a light-weighted operation.- Specified by:
toConnectionin interfaceAsyncConnection
-
getHbckInternal
-
getHbck
Description copied from interface:AsyncConnectionRetrieve an Hbck implementation to fix an HBase cluster. The returned Hbck is not guaranteed to be thread-safe. A new instance should be created by each thread. This is a lightweight operation. Pooling or caching of the returned Hbck instance is not recommended. The caller is responsible for callingCloseable.close()on the returned Hbck instance. This will be used mostly by hbck tool.- Specified by:
getHbckin interfaceAsyncConnection- Returns:
- an Hbck instance for active master. Active master is fetched from the zookeeper.
-
getHbck
Description copied from interface:AsyncConnectionRetrieve an Hbck implementation to fix an HBase cluster. The returned Hbck is not guaranteed to be thread-safe. A new instance should be created by each thread. This is a lightweight operation. Pooling or caching of the returned Hbck instance is not recommended. The caller is responsible for callingCloseable.close()on the returned Hbck instance. This will be used mostly by hbck tool. This may only be used to by pass getting registered master from ZK. In situations where ZK is not available or active master is not registered with ZK and user can get master address by other means, master can be explicitly specified.- Specified by:
getHbckin interfaceAsyncConnection- Parameters:
masterServer- explicitServerNamefor master server- Returns:
- an Hbck instance for a specified master server
-
getConnectionMetrics
-