Class ThriftConnection
java.lang.Object
org.apache.hadoop.hbase.thrift2.client.ThriftConnection
- All Implemented Interfaces:
Closeable,AutoCloseable,Abortable,Connection
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classthe default thrift client builder.static classstatic classthe default thrift http client builder. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) ThriftClientBuilderprivate org.apache.hadoop.conf.Configurationprivate intprivate Stringprivate org.apache.http.client.HttpClientprivate booleanprivate booleanprivate booleanprivate booleanprivate static final org.slf4j.Loggerprivate intprivate intprivate User -
Constructor Summary
ConstructorsConstructorDescriptionThriftConnection(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, Map<String, byte[]> connectionAttributes) -
Method Summary
Modifier and TypeMethodDescriptionvoidAbort the server or client.voidClear all the entries in the region location cache, for all the tables.voidclose()getAdmin()Get a ThriftAdmin, ThriftAdmin is NOT thread safeRetrieve aBufferedMutatorfor performing client-side buffering of writes.getBufferedMutator(TableName tableName) Retrieve aBufferedMutatorfor performing client-side buffering of writes.Returns the cluster ID unique to this HBase cluster.org.apache.hadoop.conf.ConfigurationReturns Configuration instance being used by this Connection instance.intgetHost()org.apache.http.client.HttpClientintintgetPort()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 safebooleanCheck if the server or client was aborted.booleanisClosed()Returns whether the connection is closed or not.booleanbooleanisFramed()voidsetHttpClient(org.apache.http.client.HttpClient httpClient) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ConnectionReturns Configuration instance being used by this Connection instance.- Specified by:
getConfigurationin interfaceConnection
-
getHost
-
getPort
-
isFramed
-
isCompact
-
getOperationTimeout
-
getConnectTimeout
-
getAdmin
Get a ThriftAdmin, ThriftAdmin is NOT thread safe- Specified by:
getAdminin interfaceConnection- Returns:
- a ThriftAdmin
- Throws:
IOException- IOException
-
getHttpClient
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceConnection- Throws:
IOException
-
isClosed
Description copied from interface:ConnectionReturns whether the connection is closed or not.- Specified by:
isClosedin interfaceConnection- Returns:
- true if this connection is closed
-
getTableBuilder
Get a TableBuider to build ThriftTable, ThriftTable is NOT thread safe- Specified by:
getTableBuilderin 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:AbortableAbort the server or client. -
isAborted
Description copied from interface:AbortableCheck if the server or client was aborted. -
getBufferedMutator
Description copied from interface:ConnectionRetrieve a
BufferedMutatorfor performing client-side buffering of writes. TheBufferedMutatorreturned 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 returnedBufferedMutatorinstance.- Specified by:
getBufferedMutatorin interfaceConnection- Parameters:
tableName- the name of the table- Returns:
- a
BufferedMutatorfor the supplied tableName. - Throws:
IOException
-
getBufferedMutator
Description copied from interface:ConnectionRetrieve aBufferedMutatorfor performing client-side buffering of writes. TheBufferedMutatorreturned 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 callsBufferedMutator.close(). The caller is responsible for callingBufferedMutator.close()on the returnedBufferedMutatorinstance.- Specified by:
getBufferedMutatorin interfaceConnection- Parameters:
params- details on how to instantiate theBufferedMutator.- Returns:
- a
BufferedMutatorfor the supplied tableName. - Throws:
IOException
-
getRegionLocator
Description copied from interface:ConnectionRetrieve 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:
getRegionLocatorin 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:ConnectionClear 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:
clearRegionLocationCachein interfaceConnection
-
getClusterId
Description copied from interface:ConnectionReturns the cluster ID unique to this HBase cluster.
The default implementation is added to keep client compatibility.- Specified by:
getClusterIdin interfaceConnection
-