Package org.apache.hadoop.hbase.thrift
Class HBaseServiceHandler
java.lang.Object
org.apache.hadoop.hbase.thrift.HBaseServiceHandler
- Direct Known Subclasses:
ThriftHBaseServiceHandler,ThriftHBaseServiceHandler
abstract class for HBase handler providing a Connection cache and get table/admin method
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected org.apache.hadoop.conf.Configurationprotected final ConnectionCacheprivate static final org.slf4j.Loggerstatic final Stringprotected ThriftMetricsprivate final AtomicIntegerprivate final org.apache.hbase.thirdparty.com.google.common.cache.Cache<Integer,HBaseServiceHandler.ResultScannerWrapper> -
Constructor Summary
ConstructorsConstructorDescriptionHBaseServiceHandler(org.apache.hadoop.conf.Configuration c, UserProvider userProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected intaddScanner(ResultScanner scanner, boolean sortColumns) Assigns a unique ID to the scanner and adds the mapping to an internal HashMap.protected voidaddScannerBack(int id, HBaseServiceHandler.ResultScannerWrapper wrapper) Add the given scanner back to scanner map.protected AdmingetAdmin()Obtain HBaseAdmin.protected TablegetTable(byte[] tableName) Creates and returns a Table instance from a given table name.protected TablegetTable(ByteBuffer tableName) voidinitMetrics(ThriftMetrics metrics) protected HBaseServiceHandler.ResultScannerWrapperremoveScanner(int id) Removes the scanner associated with the specified ID from the internal HashMap.voidsetEffectiveUser(String effectiveUser)
-
Field Details
-
LOG
-
CLEANUP_INTERVAL
- See Also:
-
MAX_IDLETIME
- See Also:
-
conf
-
connectionCache
-
nextScannerId
-
scannerMap
private final org.apache.hbase.thirdparty.com.google.common.cache.Cache<Integer,HBaseServiceHandler.ResultScannerWrapper> scannerMap -
removeScannerLock
-
metrics
-
-
Constructor Details
-
HBaseServiceHandler
public HBaseServiceHandler(org.apache.hadoop.conf.Configuration c, UserProvider userProvider) throws IOException - Throws:
IOException
-
-
Method Details
-
initMetrics
-
setEffectiveUser
-
addScanner
Assigns a unique ID to the scanner and adds the mapping to an internal HashMap.- Parameters:
scanner- to add- Returns:
- Id for this Scanner
-
addScannerBack
Add the given scanner back to scanner map.When scanning, we need to remove the scanner from scanner map to prevent expiration during scanning.
-
removeScanner
Removes the scanner associated with the specified ID from the internal HashMap.- Parameters:
id- of the Scanner to remove- Throws:
AccessDeniedException- if the scanner is not belong to the current userIOException
-
getAdmin
Obtain HBaseAdmin. Creates the instance if it is not already created.- Throws:
IOException
-
getTable
Creates and returns a Table instance from a given table name. name of table- Returns:
- Table object
- Throws:
IOException- if getting the table fails
-
getTable
- Throws:
IOException
-