@InterfaceAudience.Private public class ThriftConnection extends Object implements Connection
| Modifier and Type | Class and Description |
|---|---|
static class |
ThriftConnection.DefaultThriftClientBuilder
the default thrift client builder.
|
static class |
ThriftConnection.DelayRetryHandler |
static class |
ThriftConnection.HTTPThriftClientBuilder
the default thrift http client builder.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) ThriftClientBuilder |
clientBuilder |
private org.apache.hadoop.conf.Configuration |
conf |
private int |
connectTimeout |
private String |
host |
private org.apache.http.client.HttpClient |
httpClient |
private boolean |
httpClientCreated |
private boolean |
isClosed |
private boolean |
isCompact |
private boolean |
isFramed |
private static org.slf4j.Logger |
LOG |
private int |
operationTimeout |
private int |
port |
private User |
user |
| Constructor and Description |
|---|
ThriftConnection(org.apache.hadoop.conf.Configuration conf,
ExecutorService pool,
User user) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(String why,
Throwable e)
Abort the server or client.
|
void |
clearRegionLocationCache()
Clear all the entries in the region location cache, for all the tables.
|
void |
close() |
Admin |
getAdmin()
Get a ThriftAdmin, ThriftAdmin is NOT thread safe
|
BufferedMutator |
getBufferedMutator(BufferedMutatorParams params)
Retrieve a
BufferedMutator for performing client-side buffering of writes. |
BufferedMutator |
getBufferedMutator(TableName tableName)
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.
|
int |
getConnectTimeout() |
String |
getHost() |
org.apache.http.client.HttpClient |
getHttpClient() |
int |
getOperationTimeout() |
int |
getPort() |
RegionLocator |
getRegionLocator(TableName tableName)
Retrieve a RegionLocator implementation to inspect region information on a table.
|
TableBuilder |
getTableBuilder(TableName tableName,
ExecutorService pool)
Get a TableBuider to build ThriftTable, ThriftTable is NOT thread safe
|
boolean |
isAborted()
Check if the server or client was aborted.
|
boolean |
isClosed()
Returns whether the connection is closed or not.
|
boolean |
isCompact() |
boolean |
isFramed() |
void |
setHttpClient(org.apache.http.client.HttpClient httpClient) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHbck, getHbck, getTable, getTableprivate static final org.slf4j.Logger LOG
private org.apache.hadoop.conf.Configuration conf
private org.apache.http.client.HttpClient httpClient
private boolean httpClientCreated
private boolean isClosed
private int port
private boolean isFramed
private boolean isCompact
ThriftClientBuilder clientBuilder
private int operationTimeout
private int connectTimeout
public ThriftConnection(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user) throws IOException
IOExceptionpublic void setHttpClient(org.apache.http.client.HttpClient httpClient)
public org.apache.hadoop.conf.Configuration getConfiguration()
ConnectiongetConfiguration in interface Connectionpublic int getPort()
public boolean isFramed()
public boolean isCompact()
public int getOperationTimeout()
public int getConnectTimeout()
public Admin getAdmin() throws IOException
getAdmin in interface ConnectionIOException - IOExceptionpublic org.apache.http.client.HttpClient getHttpClient()
public void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface ConnectionIOExceptionpublic boolean isClosed()
ConnectionisClosed in interface Connectionpublic TableBuilder getTableBuilder(TableName tableName, ExecutorService pool)
getTableBuilder in interface ConnectiontableName - the name of the tablepool - the thread pool to use for requests like batch and scanIOException - IOExceptionpublic void abort(String why, Throwable e)
Abortablepublic boolean isAborted()
Abortablepublic BufferedMutator getBufferedMutator(TableName tableName) throws IOException
Connection
Retrieve a BufferedMutator for performing client-side buffering of writes. The
BufferedMutator returned by this method is thread-safe. This accessor will create a new
ThreadPoolExecutor and will be shutdown once we close the BufferedMutator. This object can be
used for long lived operations.
The caller is responsible for calling BufferedMutator.close() on the returned
BufferedMutator instance.
getBufferedMutator in interface ConnectiontableName - the name of the tableBufferedMutator for the supplied tableName.IOExceptionpublic BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException
ConnectionBufferedMutator 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. If user passes ThreadPool in BufferedMutatorParams then we will
use that otherwise we will create for the user. For user specified ThreadPool, it is the user's
responsibility to shutdown. For ThreadPool created by us, we will shutdown when user calls
BufferedMutator.close(). The caller is responsible for calling
BufferedMutator.close() on the returned BufferedMutator instance.getBufferedMutator in interface Connectionparams - details on how to instantiate the BufferedMutator.BufferedMutator for the supplied tableName.IOExceptionpublic RegionLocator getRegionLocator(TableName tableName) throws IOException
ConnectionCloseable.close() on the returned
RegionLocator instance. RegionLocator needs to be unmanagedgetRegionLocator in interface ConnectiontableName - Name of the table who's region is to be examinedIOExceptionpublic void clearRegionLocationCache()
ConnectionRegionLocator.clearRegionLocationCache().
This may cause performance issue so use it with caution.clearRegionLocationCache in interface Connectionpublic String getClusterId()
ConnectiongetClusterId in interface ConnectionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.