Interface AsyncConnection
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Subinterfaces:
AsyncClusterConnection
- All Known Implementing Classes:
AsyncClusterConnectionImpl
,AsyncConnectionImpl
,SharedAsyncConnection
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear all the entries in the region location cache, for all the tables.default AsyncAdmin
getAdmin()
Retrieve anAsyncAdmin
implementation to administer an HBase cluster.default AsyncAdmin
getAdmin
(ExecutorService pool) Retrieve anAsyncAdmin
implementation to administer an HBase cluster.Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.default AsyncBufferedMutator
getBufferedMutator
(TableName tableName) Retrieve anAsyncBufferedMutator
for performing client-side buffering of writes.default AsyncBufferedMutator
getBufferedMutator
(TableName tableName, ExecutorService pool) Retrieve anAsyncBufferedMutator
for performing client-side buffering of writes.getBufferedMutatorBuilder
(TableName tableName) Returns anAsyncBufferedMutatorBuilder
for creatingAsyncBufferedMutator
.getBufferedMutatorBuilder
(TableName tableName, ExecutorService pool) Returns anAsyncBufferedMutatorBuilder
for creatingAsyncBufferedMutator
.org.apache.hadoop.conf.Configuration
Returns theConfiguration
object used by this instance.getHbck()
Retrieve an Hbck implementation to fix an HBase cluster.getHbck
(ServerName masterServer) Retrieve an Hbck implementation to fix an HBase cluster.getRegionLocator
(TableName tableName) Retrieve a AsyncRegionLocator implementation to inspect region information on a table.default AsyncTable<AdvancedScanResultConsumer>
Retrieve anAsyncTable
implementation for accessing a table.default AsyncTable<ScanResultConsumer>
getTable
(TableName tableName, ExecutorService pool) Retrieve anAsyncTable
implementation for accessing a table.getTableBuilder
(TableName tableName) Returns anAsyncTableBuilder
for creatingAsyncTable
.getTableBuilder
(TableName tableName, ExecutorService pool) Returns anAsyncTableBuilder
for creatingAsyncTable
.boolean
isClosed()
Returns whether the connection is closed or not.Convert this connection to aConnection
.
-
Method Details
-
getConfiguration
org.apache.hadoop.conf.Configuration getConfiguration()Returns theConfiguration
object used by this instance.The reference returned is not a copy, so any change made to it will affect this instance.
-
getRegionLocator
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.- Parameters:
tableName
- Name of the table who's region is to be examined- Returns:
- An AsyncRegionLocator instance
-
clearRegionLocationCache
void clearRegionLocationCache()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. -
getTable
Retrieve anAsyncTable
implementation for accessing a table.The returned instance will use default configs. Use
getTableBuilder(TableName)
if you want to customize some configs.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.
The 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. And also the observer style scan API will useAdvancedScanResultConsumer
which is designed for experts only. Only use it when you know what you are doing.- Parameters:
tableName
- the name of the table- Returns:
- an AsyncTable to use for interactions with this table
- See Also:
-
getTableBuilder
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.
- Parameters:
tableName
- the name of the table
-
getTable
Retrieve anAsyncTable
implementation for accessing a table.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.
- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for executing callback- Returns:
- an AsyncTable to use for interactions with this table
-
getTableBuilder
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.
- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for executing callback
-
getAdmin
Retrieve anAsyncAdmin
implementation to administer an HBase cluster.The returned instance will use default configs. Use
getAdminBuilder()
if you want to customize some configs.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.- Returns:
- an
AsyncAdmin
instance for cluster administration
-
getAdminBuilder
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. -
getAdmin
Retrieve anAsyncAdmin
implementation to administer an HBase cluster.The returned instance will use default configs. Use
getAdminBuilder(ExecutorService)
if you want to customize some configs.- Parameters:
pool
- the thread pool to use for executing callback- Returns:
- an
AsyncAdmin
instance for cluster administration
-
getAdminBuilder
Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.- Parameters:
pool
- the thread pool to use for executing callback
-
getBufferedMutator
Retrieve anAsyncBufferedMutator
for performing client-side buffering of writes.The returned instance will use default configs. Use
getBufferedMutatorBuilder(TableName)
if you want to customize some configs.- Parameters:
tableName
- the name of the table- Returns:
- an
AsyncBufferedMutator
for the supplied tableName.
-
getBufferedMutatorBuilder
Returns anAsyncBufferedMutatorBuilder
for creatingAsyncBufferedMutator
.- Parameters:
tableName
- the name of the table
-
getBufferedMutator
Retrieve anAsyncBufferedMutator
for performing client-side buffering of writes.The returned instance will use default configs. Use
getBufferedMutatorBuilder(TableName, ExecutorService)
if you want to customize some configs.- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for executing callback- Returns:
- an
AsyncBufferedMutator
for the supplied tableName.
-
getBufferedMutatorBuilder
Returns anAsyncBufferedMutatorBuilder
for creatingAsyncBufferedMutator
.- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for executing callback
-
isClosed
boolean isClosed()Returns whether the connection is closed or not.- Returns:
- true if this connection is closed
-
toConnection
Convert 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. -
getHbck
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.- Returns:
- an Hbck instance for active master. Active master is fetched from the zookeeper.
-
getHbck
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.- Parameters:
masterServer
- explicitServerName
for master server- Returns:
- an Hbck instance for a specified master server
- Throws:
IOException
-