@InterfaceAudience.Private class ConnectionOverAsyncConnection extends Object implements Connection
AsyncConnection
.Modifier and Type | Field and Description |
---|---|
private boolean |
aborted |
private ExecutorService |
batchPool |
private AsyncConnectionImpl |
conn |
private ConnectionConfiguration |
connConf |
private static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
ConnectionOverAsyncConnection(AsyncConnectionImpl conn) |
Modifier and Type | Method and Description |
---|---|
void |
abort(String why,
Throwable error)
Abort the server or client.
|
void |
clearRegionLocationCache()
Clear all the entries in the region location cache, for all the tables.
|
void |
close() |
(package private) void |
closePool() |
private ThreadPoolExecutor |
createThreadPool() |
Admin |
getAdmin()
Retrieve an Admin implementation to administer an HBase cluster.
|
private ExecutorService |
getBatchPool() |
BufferedMutator |
getBufferedMutator(BufferedMutatorParams params)
Retrieve a
BufferedMutator for performing client-side buffering of writes. |
String |
getClusterId()
Returns the cluster ID unique to this HBase cluster.
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Returns Configuration instance being used by this Connection instance.
|
Hbck |
getHbck()
Retrieve an Hbck implementation to fix an HBase cluster.
|
Hbck |
getHbck(ServerName masterServer)
Retrieve an Hbck implementation to fix an HBase cluster.
|
RegionLocator |
getRegionLocator(TableName tableName)
Retrieve a RegionLocator implementation to inspect region information on a table.
|
TableBuilder |
getTableBuilder(TableName tableName,
ExecutorService pool)
Returns an
TableBuilder for creating Table . |
boolean |
isAborted()
Check if the server or client was aborted.
|
boolean |
isClosed()
Returns whether the connection is closed or not.
|
AsyncConnection |
toAsyncConnection()
Convert this connection to an
AsyncConnection . |
String |
toString()
An identifier that will remain the same for a given connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBufferedMutator, getTable, getTable
private static final org.slf4j.Logger LOG
private volatile boolean aborted
private volatile ExecutorService batchPool
private final AsyncConnectionImpl conn
private final ConnectionConfiguration connConf
ConnectionOverAsyncConnection(AsyncConnectionImpl conn)
public void abort(String why, Throwable error)
Abortable
public boolean isAborted()
Abortable
public org.apache.hadoop.conf.Configuration getConfiguration()
Connection
getConfiguration
in interface Connection
public BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException
Connection
BufferedMutator
for performing client-side buffering of writes. The
BufferedMutator
returned by this method is thread-safe. This object can be used for
long lived table operations. The caller is responsible for calling
BufferedMutator.close()
on the returned BufferedMutator
instance.getBufferedMutator
in interface Connection
params
- details on how to instantiate the BufferedMutator
.BufferedMutator
for the supplied tableName.IOException
public RegionLocator getRegionLocator(TableName tableName) throws IOException
Connection
Closeable.close()
on the returned
RegionLocator instance. RegionLocator needs to be unmanagedgetRegionLocator
in interface Connection
tableName
- Name of the table who's region is to be examinedIOException
public void clearRegionLocationCache()
Connection
RegionLocator.clearRegionLocationCache()
.
This may cause performance issue so use it with caution.clearRegionLocationCache
in interface Connection
public Admin getAdmin() throws IOException
Connection
Admin.close()
on the returned Admin instance.getAdmin
in interface Connection
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Connection
IOException
void closePool()
public boolean isClosed()
Connection
isClosed
in interface Connection
private ThreadPoolExecutor createThreadPool()
private ExecutorService getBatchPool() throws IOException
IOException
public TableBuilder getTableBuilder(TableName tableName, ExecutorService pool)
Connection
TableBuilder
for creating Table
.getTableBuilder
in interface Connection
tableName
- the name of the tablepool
- the thread pool to use for requests like batch and scanpublic AsyncConnection toAsyncConnection()
Connection
AsyncConnection
.
Usually we will return the same instance if you call this method multiple times so you can
consider this as a light-weighted operation.toAsyncConnection
in interface Connection
public String getClusterId()
Connection
getClusterId
in interface Connection
public Hbck getHbck() throws IOException
Connection
Closeable.close()
on the returned Hbck instance. getHbck
in interface Connection
IOException
public Hbck getHbck(ServerName masterServer) throws IOException
Connection
Closeable.close()
on the returned Hbck instance. getHbck
in interface Connection
masterServer
- explicit ServerName
for master serverIOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.