Class ThriftConnection
java.lang.Object
org.apache.hadoop.hbase.thrift2.client.ThriftConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Abortable
,Connection
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
the default thrift client builder.static class
static class
the default thrift http client builder. -
Field Summary
Modifier and TypeFieldDescription(package private) ThriftClientBuilder
private org.apache.hadoop.conf.Configuration
private int
private String
private org.apache.http.client.HttpClient
private boolean
private boolean
private boolean
private boolean
private static final org.slf4j.Logger
private int
private int
private User
-
Constructor Summary
ConstructorDescriptionThriftConnection
(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, Map<String, byte[]> connectionAttributes) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort the server or client.void
Clear all the entries in the region location cache, for all the tables.void
close()
getAdmin()
Get a ThriftAdmin, ThriftAdmin is NOT thread safeRetrieve aBufferedMutator
for performing client-side buffering of writes.getBufferedMutator
(TableName tableName) Retrieve aBufferedMutator
for performing client-side buffering of writes.Returns the cluster ID unique to this HBase cluster.org.apache.hadoop.conf.Configuration
Returns Configuration instance being used by this Connection instance.int
getHost()
org.apache.http.client.HttpClient
int
int
getPort()
getRegionLocator
(TableName tableName) Retrieve a RegionLocator implementation to inspect region information on a table.getTableBuilder
(TableName tableName, ExecutorService pool) Get a TableBuider to build ThriftTable, ThriftTable is NOT thread safeboolean
Check if the server or client was aborted.boolean
isClosed()
Returns whether the connection is closed or not.boolean
boolean
isFramed()
void
setHttpClient
(org.apache.http.client.HttpClient httpClient) Convert this connection to anAsyncConnection
.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.Connection
getHbck, getHbck, getTable, getTable
-
Field Details
-
LOG
-
conf
-
user
-
httpClient
-
httpClientCreated
-
isClosed
-
host
-
port
-
isFramed
-
isCompact
-
clientBuilder
-
operationTimeout
-
connectTimeout
-
-
Constructor Details
-
ThriftConnection
public ThriftConnection(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, Map<String, byte[]> connectionAttributes) throws IOException- Throws:
IOException
-
-
Method Details
-
setHttpClient
-
getConfiguration
Description copied from interface:Connection
Returns Configuration instance being used by this Connection instance.- Specified by:
getConfiguration
in interfaceConnection
-
getHost
-
getPort
-
isFramed
-
isCompact
-
getOperationTimeout
-
getConnectTimeout
-
getAdmin
Get a ThriftAdmin, ThriftAdmin is NOT thread safe- Specified by:
getAdmin
in interfaceConnection
- Returns:
- a ThriftAdmin
- Throws:
IOException
- IOException
-
getHttpClient
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnection
- Throws:
IOException
-
isClosed
Description copied from interface:Connection
Returns whether the connection is closed or not.- Specified by:
isClosed
in interfaceConnection
- Returns:
- true if this connection is closed
-
getTableBuilder
Get a TableBuider to build ThriftTable, ThriftTable is NOT thread safe- Specified by:
getTableBuilder
in interfaceConnection
- Parameters:
tableName
- the name of the tablepool
- the thread pool to use for requests like batch and scan- Returns:
- a TableBuilder
- Throws:
IOException
- IOException
-
abort
Description copied from interface:Abortable
Abort the server or client. -
isAborted
Description copied from interface:Abortable
Check if the server or client was aborted. -
getBufferedMutator
Description copied from interface:Connection
Retrieve a
BufferedMutator
for performing client-side buffering of writes. TheBufferedMutator
returned by this method is thread-safe. This BufferedMutator will use the Connection's ExecutorService. This object can be used for long lived operations.The caller is responsible for calling
BufferedMutator.close()
on the returnedBufferedMutator
instance.This accessor will use the connection's ExecutorService and will throw an exception in the main thread when an asynchronous exception occurs.
- Specified by:
getBufferedMutator
in interfaceConnection
- Parameters:
tableName
- the name of the table- Returns:
- a
BufferedMutator
for the supplied tableName. - Throws:
IOException
-
getBufferedMutator
Description copied from interface:Connection
Retrieve aBufferedMutator
for performing client-side buffering of writes. TheBufferedMutator
returned by this method is thread-safe. This object can be used for long lived table operations. The caller is responsible for callingBufferedMutator.close()
on the returnedBufferedMutator
instance.- Specified by:
getBufferedMutator
in interfaceConnection
- Parameters:
params
- details on how to instantiate theBufferedMutator
.- Returns:
- a
BufferedMutator
for the supplied tableName. - Throws:
IOException
-
getRegionLocator
Description copied from interface:Connection
Retrieve a RegionLocator implementation to inspect region information on a table. The returned RegionLocator 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 RegionLocator is neither required nor desired.
The caller is responsible for callingCloseable.close()
on the returned RegionLocator instance. RegionLocator needs to be unmanaged- Specified by:
getRegionLocator
in interfaceConnection
- Parameters:
tableName
- Name of the table who's region is to be examined- Returns:
- A RegionLocator instance
- Throws:
IOException
-
clearRegionLocationCache
Description copied from interface:Connection
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, useRegionLocator.clearRegionLocationCache()
. This may cause performance issue so use it with caution.- Specified by:
clearRegionLocationCache
in interfaceConnection
-
toAsyncConnection
Description copied from interface:Connection
Convert this connection to anAsyncConnection
. 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:
toAsyncConnection
in interfaceConnection
-
getClusterId
Description copied from interface:Connection
Returns the cluster ID unique to this HBase cluster.
The default implementation is added to keep client compatibility.- Specified by:
getClusterId
in interfaceConnection
-