Package org.apache.hadoop.hbase.client
Class AsyncConnectionImpl
java.lang.Object
org.apache.hadoop.hbase.client.AsyncConnectionImpl
- All Implemented Interfaces:
Closeable
,AutoCloseable
,AsyncConnection
The implementation of AsyncConnection.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ConcurrentMap<String,
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.Interface> private final ClientBackoffPolicy
(package private) final AsyncRpcRetryingCallerFactory
private ChoreService
private boolean
private final ClusterStatusListener
private final org.apache.hadoop.conf.Configuration
(package private) final AsyncConnectionConfiguration
private final AsyncRegionLocator
private static final org.slf4j.Logger
private 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 String
private final NonceGenerator
(package private) final ConnectionRegistry
(package private) static final org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer
private final RpcClient
(package private) final RpcControllerFactory
private final int
private final ConcurrentMap<String,
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface> private final Optional<ServerStatisticTracker>
private final User
-
Constructor Summary
ConstructorDescriptionAsyncConnectionImpl
(org.apache.hadoop.conf.Configuration conf, ConnectionRegistry registry, String clusterId, User user) AsyncConnectionImpl
(org.apache.hadoop.conf.Configuration conf, ConnectionRegistry registry, String clusterId, User user, Map<String, byte[]> connectionAttributes) -
Method Summary
Modifier and TypeMethodDescription(package private) void
clearMasterStubCache
(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface stub) void
Clear all the entries in the region location cache, for all the tables.void
close()
private org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.Interface
createAdminServerStub
(ServerName serverName) private org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface
createMasterStub
(ServerName serverName) private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface
createRegionServerStub
(ServerName serverName) Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.(package private) org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.Interface
getAdminStub
(ServerName serverName) (package private) ClientBackoffPolicy
getBufferedMutatorBuilder
(TableName tableName) Returns anAsyncBufferedMutatorBuilder
for creatingAsyncBufferedMutator
.getBufferedMutatorBuilder
(TableName tableName, ExecutorService pool) Returns anAsyncBufferedMutatorBuilder
for creatingAsyncBufferedMutator
.(package private) ChoreService
If choreService has not been created yet, create the ChoreService.(package private) String
org.apache.hadoop.conf.Configuration
Returns theConfiguration
object 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 Hbck
getHbckInternal
(ServerName masterServer) (package private) AsyncRegionLocator
(package private) CompletableFuture<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.Interface>
getRegionLocator
(TableName tableName) Retrieve a AsyncRegionLocator implementation to inspect region information on a table.(package private) org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.Interface
getRegionServerStub
(ServerName serverName) (package private) Optional<ServerStatisticTracker>
getTableBuilder
(TableName tableName) Returns anAsyncTableBuilder
for creatingAsyncTable
.getTableBuilder
(TableName tableName, ExecutorService pool) Returns anAsyncTableBuilder
for creatingAsyncTable
.getUser()
boolean
isClosed()
Returns whether the connection is closed or not.private void
logCallStack
(StackTraceElement[] stackTraceElements) private void
spawnRenewalChore
(org.apache.hadoop.security.UserGroupInformation user) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 -
adminSubs
private final ConcurrentMap<String,org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.Interface> adminSubs -
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
-
-
Constructor Details
-
AsyncConnectionImpl
public AsyncConnectionImpl(org.apache.hadoop.conf.Configuration conf, ConnectionRegistry registry, String clusterId, User user) -
AsyncConnectionImpl
public AsyncConnectionImpl(org.apache.hadoop.conf.Configuration conf, ConnectionRegistry registry, String clusterId, 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:AsyncConnection
Returns theConfiguration
object used by this instance.The reference returned is not a copy, so any change made to it will affect this instance.
- Specified by:
getConfiguration
in interfaceAsyncConnection
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
logCallStack
-
isClosed
Description copied from interface:AsyncConnection
Returns whether the connection is closed or not.- Specified by:
isClosed
in interfaceAsyncConnection
- Returns:
- true if this connection is closed
-
getRegionLocator
Description copied from interface:AsyncConnection
Retrieve 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:
getRegionLocator
in interfaceAsyncConnection
- Parameters:
tableName
- Name of the table who's region is to be examined- Returns:
- An AsyncRegionLocator instance
-
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:AsyncConnection
Returns anAsyncTableBuilder
for 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:
getTableBuilder
in interfaceAsyncConnection
- Parameters:
tableName
- the name of the table
-
getTableBuilder
public AsyncTableBuilder<ScanResultConsumer> getTableBuilder(TableName tableName, ExecutorService pool) Description copied from interface:AsyncConnection
Returns anAsyncTableBuilder
for 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:
getTableBuilder
in interfaceAsyncConnection
- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for executing callback
-
getAdminBuilder
Description copied from interface:AsyncConnection
Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.The admin operation's returned
CompletableFuture
will 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:
getAdminBuilder
in interfaceAsyncConnection
-
getAdminBuilder
Description copied from interface:AsyncConnection
Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.- Specified by:
getAdminBuilder
in interfaceAsyncConnection
- Parameters:
pool
- the thread pool to use for executing callback
-
getBufferedMutatorBuilder
Description copied from interface:AsyncConnection
Returns anAsyncBufferedMutatorBuilder
for creatingAsyncBufferedMutator
.- Specified by:
getBufferedMutatorBuilder
in interfaceAsyncConnection
- Parameters:
tableName
- the name of the table
-
getBufferedMutatorBuilder
public AsyncBufferedMutatorBuilder getBufferedMutatorBuilder(TableName tableName, ExecutorService pool) Description copied from interface:AsyncConnection
Returns anAsyncBufferedMutatorBuilder
for creatingAsyncBufferedMutator
.- Specified by:
getBufferedMutatorBuilder
in interfaceAsyncConnection
- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for executing callback
-
getHbckInternal
-
getHbck
Description copied from interface:AsyncConnection
Retrieve 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:
getHbck
in interfaceAsyncConnection
- Returns:
- an Hbck instance for active master. Active master is fetched from the zookeeper.
-
getHbck
Description copied from interface:AsyncConnection
Retrieve 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:
getHbck
in interfaceAsyncConnection
- Parameters:
masterServer
- explicitServerName
for master server- Returns:
- an Hbck instance for a specified master server
-
clearRegionLocationCache
Description copied from interface:AsyncConnection
Clear 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:
clearRegionLocationCache
in interfaceAsyncConnection
-
getConnectionMetrics
-