Package org.apache.hadoop.hbase.client
Class SharedAsyncConnection
java.lang.Object
org.apache.hadoop.hbase.client.SharedAsyncConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,AsyncConnection
Wraps a
AsyncConnection
to make it can't be closed.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear all the entries in the region location cache, for all the tables.void
close()
Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.Returns anAsyncAdminBuilder
for creatingAsyncAdmin
.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.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
.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
-
conn
-
-
Constructor Details
-
SharedAsyncConnection
-
-
Method Details
-
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
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
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
-
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
-
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
-
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
-
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
- Throws:
IOException
-
toConnection
Description copied from interface:AsyncConnection
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.- Specified by:
toConnection
in interfaceAsyncConnection
-