org.apache.hadoop.hbase.client
Class HConnectionManager.HConnectionImplementation

java.lang.Object
  extended by org.apache.hadoop.hbase.client.HConnectionManager.HConnectionImplementation
All Implemented Interfaces:
Closeable, Abortable, HConnection
Enclosing class:
HConnectionManager

@InterfaceAudience.Private
public static class HConnectionManager.HConnectionImplementation
extends Object
implements HConnection, Closeable

Encapsulates connection to zookeeper and regionservers.


Field Summary
protected  String clusterId
           
protected  User user
           
 
Fields inherited from interface org.apache.hadoop.hbase.client.HConnection
HBASE_CLIENT_CONNECTION_IMPL
 
Constructor Summary
protected HConnectionManager.HConnectionImplementation(org.apache.hadoop.conf.Configuration conf)
          For tests.
 
Method Summary
 void abort(String msg, Throwable t)
          Abort the server or client.
 void clearCaches(ServerName serverName)
          Clear any caches that pertain to server name sn.
 void clearRegionCache()
          Allows flushing the region cache.
 void clearRegionCache(byte[] tableName)
           
 void clearRegionCache(TableName tableName)
          Allows flushing the region cache of all locations that pertain to tableName
 void close()
           
protected
<R> org.apache.hadoop.hbase.client.AsyncProcess
createAsyncProcess(TableName tableName, ExecutorService pool, org.apache.hadoop.hbase.client.AsyncProcess.AsyncProcessCallback<R> callback, org.apache.hadoop.conf.Configuration conf)
           
 void deleteCachedRegionLocation(HRegionLocation location)
          Deletes cached locations for the specific region.
protected  void finalize()
          Close the connection for good, regardless of what the current value of refCount is.
 org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName)
          Establishes a connection to the region server at the specified address.
 org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName, boolean master)
          Establishes a connection to the region server at the specified address.
 ClientBackoffPolicy getBackoffPolicy()
           
 org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface getClient(ServerName sn)
          Establishes a connection to the region server at the specified address, and returns a region client protocol.
 org.apache.hadoop.conf.Configuration getConfiguration()
           
 MetricsConnection getConnectionMetrics()
           
protected  ExecutorService getCurrentBatchPool()
           
 int getCurrentNrHRS()
           
 HTableDescriptor getHTableDescriptor(byte[] tableName)
           
 HTableDescriptor getHTableDescriptor(TableName tableName)
          Connects to the master to get the table descriptor.
 HTableDescriptor[] getHTableDescriptors(List<String> names)
           
 HTableDescriptor[] getHTableDescriptorsByTableName(List<TableName> tableNames)
           
 org.apache.hadoop.hbase.client.MasterKeepAliveConnection getKeepAliveMasterService()
          This function allows HBaseAdmin and potentially others to get a shared MasterService connection.
 org.apache.hadoop.hbase.protobuf.generated.MasterProtos.MasterService.BlockingInterface getMaster()
          Returns a MasterKeepAliveConnection to the active master
 NonceGenerator getNonceGenerator()
           
 boolean getRegionCachePrefetch(byte[] tableName)
           
 boolean getRegionCachePrefetch(TableName tableName)
          Check whether region cache prefetch is enabled or not.
 HRegionLocation getRegionLocation(byte[] tableName, byte[] row, boolean reload)
           
 HRegionLocation getRegionLocation(TableName tableName, byte[] row, boolean reload)
          Find region location hosting passed row
 ServerStatisticTracker getStatisticsTracker()
           
 HTableInterface getTable(byte[] tableName)
          Retrieve an HTableInterface implementation for access to a table.
 HTableInterface getTable(byte[] tableName, ExecutorService pool)
          Retrieve an HTableInterface implementation for access to a table.
 HTableInterface getTable(String tableName)
          Retrieve an HTableInterface implementation for access to a table.
 HTableInterface getTable(String tableName, ExecutorService pool)
          Retrieve an HTableInterface implementation for access to a table.
 HTableInterface getTable(TableName tableName)
          Retrieve an HTableInterface implementation for access to a table.
 HTableInterface getTable(TableName tableName, ExecutorService pool)
          Retrieve an HTableInterface implementation for access to a table.
 String[] getTableNames()
           
 boolean hasCellBlockSupport()
           
 boolean isAborted()
          Check if the server or client was aborted.
 boolean isClosed()
           
 boolean isDeadServer(ServerName sn)
           
 boolean isMasterRunning()
           
 boolean isTableAvailable(byte[] tableName)
           
 boolean isTableAvailable(byte[] tableName, byte[][] splitKeys)
           
 boolean isTableAvailable(TableName tableName)
           
 boolean isTableAvailable(TableName tableName, byte[][] splitKeys)
          Use this api to check if the table has been created with the specified number of splitkeys which was used while creating the given table.
 boolean isTableDisabled(byte[] tableName)
           
 boolean isTableDisabled(TableName tableName)
           
 boolean isTableEnabled(byte[] tableName)
           
 boolean isTableEnabled(TableName tableName)
          A table that isTableEnabled == false and isTableDisabled == false is possible.
 TableName[] listTableNames()
           
 HTableDescriptor[] listTables()
          List all the userspace tables.
 HRegionLocation locateRegion(byte[] regionName)
          Gets the location of the region of regionName.
 HRegionLocation locateRegion(byte[] tableName, byte[] row)
           
 HRegionLocation locateRegion(TableName tableName, byte[] row)
          Find the location of the region of tableName that row lives in.
 List<HRegionLocation> locateRegions(byte[] tableName)
           
 List<HRegionLocation> locateRegions(byte[] tableName, boolean useCache, boolean offlined)
           
 List<HRegionLocation> locateRegions(TableName tableName)
          Gets the locations of all regions in the specified table, tableName.
 List<HRegionLocation> locateRegions(TableName tableName, boolean useCache, boolean offlined)
          Gets the locations of all regions in the specified table, tableName.
 void processBatch(List<? extends Row> list, byte[] tableName, ExecutorService pool, Object[] results)
          Deprecated. 
 void processBatch(List<? extends Row> list, TableName tableName, ExecutorService pool, Object[] results)
          Deprecated. 
<R> void
processBatchCallback(List<? extends Row> list, byte[] tableName, ExecutorService pool, Object[] results, Batch.Callback<R> callback)
          Deprecated. 
<R> void
processBatchCallback(List<? extends Row> list, TableName tableName, ExecutorService pool, Object[] results, Batch.Callback<R> callback)
          Deprecated. since 0.96 - Use HTable.processBatchCallback(java.util.List, java.lang.Object[], org.apache.hadoop.hbase.client.coprocessor.Batch.Callback) instead
 HRegionLocation relocateRegion(byte[] tableName, byte[] row)
           
 HRegionLocation relocateRegion(TableName tableName, byte[] row)
          Find the location of the region of tableName that row lives in, ignoring any value that might be in the cache.
 void setRegionCachePrefetch(byte[] tableName, boolean enable)
           
 void setRegionCachePrefetch(TableName tableName, boolean enable)
          Enable or disable region cache prefetch for the table.
 String toString()
          An identifier that will remain the same for a given connection.
 void updateCachedLocations(byte[] tableName, byte[] rowkey, Object exception, HRegionLocation source)
           
 void updateCachedLocations(TableName tableName, byte[] rowkey, Object exception, HRegionLocation source)
          Update the location with the new value (if the exception is a RegionMovedException) or delete it from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

user

protected User user

clusterId

protected String clusterId
Constructor Detail

HConnectionManager.HConnectionImplementation

protected HConnectionManager.HConnectionImplementation(org.apache.hadoop.conf.Configuration conf)
For tests.

Method Detail

getTable

public HTableInterface getTable(String tableName)
                         throws IOException
Description copied from interface: HConnection
Retrieve an HTableInterface implementation for access to a table. The returned HTableInterface is not thread safe, a new instance should be created for each using thread. This is a lightweight operation, pooling or caching of the returned HTableInterface is neither required nor desired. Note that the HConnection needs to be unmanaged (created with HConnectionManager.createConnection(Configuration)).

Since 0.98.1 this method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.

Specified by:
getTable in interface HConnection
Returns:
an HTable to use for interactions with this table
Throws:
IOException

getTable

public HTableInterface getTable(byte[] tableName)
                         throws IOException
Description copied from interface: HConnection
Retrieve an HTableInterface implementation for access to a table. The returned HTableInterface is not thread safe, a new instance should be created for each using thread. This is a lightweight operation, pooling or caching of the returned HTableInterface is neither required nor desired. Note that the HConnection needs to be unmanaged (created with HConnectionManager.createConnection(Configuration)).

Since 0.98.1 this method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.

Specified by:
getTable in interface HConnection
Returns:
an HTable to use for interactions with this table
Throws:
IOException

getTable

public HTableInterface getTable(TableName tableName)
                         throws IOException
Description copied from interface: HConnection
Retrieve an HTableInterface implementation for access to a table. The returned HTableInterface is not thread safe, a new instance should be created for each using thread. This is a lightweight operation, pooling or caching of the returned HTableInterface is neither required nor desired. Note that the HConnection needs to be unmanaged (created with HConnectionManager.createConnection(Configuration)).

Since 0.98.1 this method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.

Specified by:
getTable in interface HConnection
Returns:
an HTable to use for interactions with this table
Throws:
IOException

getTable

public HTableInterface getTable(String tableName,
                                ExecutorService pool)
                         throws IOException
Description copied from interface: HConnection
Retrieve an HTableInterface implementation for access to a table. The returned HTableInterface is not thread safe, a new instance should be created for each using thread. This is a lightweight operation, pooling or caching of the returned HTableInterface is neither required nor desired. Note that the HConnection needs to be unmanaged (created with HConnectionManager.createConnection(Configuration)).

Since 0.98.1 this method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.

Specified by:
getTable in interface HConnection
pool - The thread pool to use for batch operations, null to use a default pool.
Returns:
an HTable to use for interactions with this table
Throws:
IOException

getTable

public HTableInterface getTable(byte[] tableName,
                                ExecutorService pool)
                         throws IOException
Description copied from interface: HConnection
Retrieve an HTableInterface implementation for access to a table. The returned HTableInterface is not thread safe, a new instance should be created for each using thread. This is a lightweight operation, pooling or caching of the returned HTableInterface is neither required nor desired. Note that the HConnection needs to be unmanaged (created with HConnectionManager.createConnection(Configuration)).

Since 0.98.1 this method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.

Specified by:
getTable in interface HConnection
pool - The thread pool to use for batch operations, null to use a default pool.
Returns:
an HTable to use for interactions with this table
Throws:
IOException

getTable

public HTableInterface getTable(TableName tableName,
                                ExecutorService pool)
                         throws IOException
Description copied from interface: HConnection
Retrieve an HTableInterface implementation for access to a table. The returned HTableInterface is not thread safe, a new instance should be created for each using thread. This is a lightweight operation, pooling or caching of the returned HTableInterface is neither required nor desired. Note that the HConnection needs to be unmanaged (created with HConnectionManager.createConnection(Configuration)).

Since 0.98.1 this method no longer checks table existence. An exception will be thrown if the table does not exist only when the first operation is attempted.

Specified by:
getTable in interface HConnection
pool - The thread pool to use for batch operations, null to use a default pool.
Returns:
an HTable to use for interactions with this table
Throws:
IOException

getConnectionMetrics

public MetricsConnection getConnectionMetrics()
Specified by:
getConnectionMetrics in interface HConnection
Returns:
the MetricsConnection instance associated with this connection.

getCurrentBatchPool

protected ExecutorService getCurrentBatchPool()

toString

public String toString()
An identifier that will remain the same for a given connection.

Overrides:
toString in class Object
Returns:

getConfiguration

public org.apache.hadoop.conf.Configuration getConfiguration()
Specified by:
getConfiguration in interface HConnection
Returns:
Configuration instance being used by this HConnection instance.

isMasterRunning

public boolean isMasterRunning()
                        throws MasterNotRunningException,
                               ZooKeeperConnectionException
Specified by:
isMasterRunning in interface HConnection
Returns:
true if the master is running, throws an exception otherwise
Throws:
MasterNotRunningException - - if the master is not running
ZooKeeperConnectionException

getRegionLocation

public HRegionLocation getRegionLocation(TableName tableName,
                                         byte[] row,
                                         boolean reload)
                                  throws IOException
Description copied from interface: HConnection
Find region location hosting passed row

Specified by:
getRegionLocation in interface HConnection
Parameters:
tableName - table name
row - Row to find.
reload - If true do not use cache, otherwise bypass.
Returns:
Location of row.
Throws:
IOException - if a remote or network exception occurs

getRegionLocation

public HRegionLocation getRegionLocation(byte[] tableName,
                                         byte[] row,
                                         boolean reload)
                                  throws IOException
Specified by:
getRegionLocation in interface HConnection
Throws:
IOException

isTableEnabled

public boolean isTableEnabled(TableName tableName)
                       throws IOException
Description copied from interface: HConnection
A table that isTableEnabled == false and isTableDisabled == false is possible. This happens when a table has a lot of regions that must be processed.

Specified by:
isTableEnabled in interface HConnection
Parameters:
tableName - table name
Returns:
true if the table is enabled, false otherwise
Throws:
IOException - if a remote or network exception occurs

isTableEnabled

public boolean isTableEnabled(byte[] tableName)
                       throws IOException
Specified by:
isTableEnabled in interface HConnection
Throws:
IOException

isTableDisabled

public boolean isTableDisabled(TableName tableName)
                        throws IOException
Specified by:
isTableDisabled in interface HConnection
Parameters:
tableName - table name
Returns:
true if the table is disabled, false otherwise
Throws:
IOException - if a remote or network exception occurs

isTableDisabled

public boolean isTableDisabled(byte[] tableName)
                        throws IOException
Specified by:
isTableDisabled in interface HConnection
Throws:
IOException

isTableAvailable

public boolean isTableAvailable(TableName tableName)
                         throws IOException
Specified by:
isTableAvailable in interface HConnection
Parameters:
tableName - table name
Returns:
true if all regions of the table are available, false otherwise
Throws:
IOException - if a remote or network exception occurs

isTableAvailable

public boolean isTableAvailable(byte[] tableName)
                         throws IOException
Specified by:
isTableAvailable in interface HConnection
Throws:
IOException

isTableAvailable

public boolean isTableAvailable(TableName tableName,
                                byte[][] splitKeys)
                         throws IOException
Description copied from interface: HConnection
Use this api to check if the table has been created with the specified number of splitkeys which was used while creating the given table. Note : If this api is used after a table's region gets splitted, the api may return false.

Specified by:
isTableAvailable in interface HConnection
Parameters:
tableName - tableName
splitKeys - splitKeys used while creating table
Throws:
IOException - if a remote or network exception occurs

isTableAvailable

public boolean isTableAvailable(byte[] tableName,
                                byte[][] splitKeys)
                         throws IOException
Specified by:
isTableAvailable in interface HConnection
Throws:
IOException

locateRegion

public HRegionLocation locateRegion(byte[] regionName)
                             throws IOException
Description copied from interface: HConnection
Gets the location of the region of regionName.

Specified by:
locateRegion in interface HConnection
Parameters:
regionName - name of the region to locate
Returns:
HRegionLocation that describes where to find the region in question
Throws:
IOException - if a remote or network exception occurs

isDeadServer

public boolean isDeadServer(ServerName sn)
Specified by:
isDeadServer in interface HConnection
Returns:
true if the server is known as dead, false otherwise.

locateRegions

public List<HRegionLocation> locateRegions(TableName tableName)
                                    throws IOException
Description copied from interface: HConnection
Gets the locations of all regions in the specified table, tableName.

Specified by:
locateRegions in interface HConnection
Parameters:
tableName - table to get regions of
Returns:
list of region locations for all regions of table
Throws:
IOException

locateRegions

public List<HRegionLocation> locateRegions(byte[] tableName)
                                    throws IOException
Specified by:
locateRegions in interface HConnection
Throws:
IOException

locateRegions

public List<HRegionLocation> locateRegions(TableName tableName,
                                           boolean useCache,
                                           boolean offlined)
                                    throws IOException
Description copied from interface: HConnection
Gets the locations of all regions in the specified table, tableName.

Specified by:
locateRegions in interface HConnection
Parameters:
tableName - table to get regions of
useCache - Should we use the cache to retrieve the region information.
offlined - True if we are to include offlined regions, false and we'll leave out offlined regions from returned list.
Returns:
list of region locations for all regions of table
Throws:
IOException

locateRegions

public List<HRegionLocation> locateRegions(byte[] tableName,
                                           boolean useCache,
                                           boolean offlined)
                                    throws IOException
Specified by:
locateRegions in interface HConnection
Throws:
IOException

locateRegion

public HRegionLocation locateRegion(TableName tableName,
                                    byte[] row)
                             throws IOException
Description copied from interface: HConnection
Find the location of the region of tableName that row lives in.

Specified by:
locateRegion in interface HConnection
Parameters:
tableName - name of the table row is in
row - row key you're trying to find the region of
Returns:
HRegionLocation that describes where to find the region in question
Throws:
IOException - if a remote or network exception occurs

locateRegion

public HRegionLocation locateRegion(byte[] tableName,
                                    byte[] row)
                             throws IOException
Specified by:
locateRegion in interface HConnection
Throws:
IOException

relocateRegion

public HRegionLocation relocateRegion(TableName tableName,
                                      byte[] row)
                               throws IOException
Description copied from interface: HConnection
Find the location of the region of tableName that row lives in, ignoring any value that might be in the cache.

Specified by:
relocateRegion in interface HConnection
Parameters:
tableName - name of the table row is in
row - row key you're trying to find the region of
Returns:
HRegionLocation that describes where to find the region in question
Throws:
IOException - if a remote or network exception occurs

relocateRegion

public HRegionLocation relocateRegion(byte[] tableName,
                                      byte[] row)
                               throws IOException
Specified by:
relocateRegion in interface HConnection
Throws:
IOException

clearCaches

public void clearCaches(ServerName serverName)
Description copied from interface: HConnection
Clear any caches that pertain to server name sn.

Specified by:
clearCaches in interface HConnection
Parameters:
serverName - A server name

clearRegionCache

public void clearRegionCache()
Description copied from interface: HConnection
Allows flushing the region cache.

Specified by:
clearRegionCache in interface HConnection

clearRegionCache

public void clearRegionCache(TableName tableName)
Description copied from interface: HConnection
Allows flushing the region cache of all locations that pertain to tableName

Specified by:
clearRegionCache in interface HConnection
Parameters:
tableName - Name of the table whose regions we are to remove from cache.

clearRegionCache

public void clearRegionCache(byte[] tableName)
Specified by:
clearRegionCache in interface HConnection

getAdmin

public org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName)
                                                                                               throws IOException
Description copied from interface: HConnection
Establishes a connection to the region server at the specified address.

Specified by:
getAdmin in interface HConnection
Returns:
proxy for HRegionServer
Throws:
IOException - if a remote or network exception occurs

getAdmin

public org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdmin(ServerName serverName,
                                                                                                      boolean master)
                                                                                               throws IOException
Description copied from interface: HConnection
Establishes a connection to the region server at the specified address.

Specified by:
getAdmin in interface HConnection
master - do we check if master is alive
Returns:
proxy for HRegionServer
Throws:
IOException - if a remote or network exception occurs

getClient

public org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface getClient(ServerName sn)
                                                                                                  throws IOException
Description copied from interface: HConnection
Establishes a connection to the region server at the specified address, and returns a region client protocol.

Specified by:
getClient in interface HConnection
Returns:
ClientProtocol proxy for RegionServer
Throws:
IOException - if a remote or network exception occurs

getMaster

public org.apache.hadoop.hbase.protobuf.generated.MasterProtos.MasterService.BlockingInterface getMaster()
                                                                                                  throws MasterNotRunningException
Description copied from interface: HConnection
Returns a MasterKeepAliveConnection to the active master

Specified by:
getMaster in interface HConnection
Throws:
MasterNotRunningException

getKeepAliveMasterService

public org.apache.hadoop.hbase.client.MasterKeepAliveConnection getKeepAliveMasterService()
                                                                                   throws MasterNotRunningException
Description copied from interface: HConnection
This function allows HBaseAdmin and potentially others to get a shared MasterService connection.

Specified by:
getKeepAliveMasterService in interface HConnection
Returns:
The shared instance. Never returns null.
Throws:
MasterNotRunningException

deleteCachedRegionLocation

public void deleteCachedRegionLocation(HRegionLocation location)
Description copied from interface: HConnection
Deletes cached locations for the specific region.

Specified by:
deleteCachedRegionLocation in interface HConnection
Parameters:
location - The location object for the region, to be purged from cache.

updateCachedLocations

public void updateCachedLocations(TableName tableName,
                                  byte[] rowkey,
                                  Object exception,
                                  HRegionLocation source)
Update the location with the new value (if the exception is a RegionMovedException) or delete it from the cache. Does nothing if we can be sure from the exception that the location is still accurate, or if the cache has already been updated.

Specified by:
updateCachedLocations in interface HConnection
Parameters:
exception - an object (to simplify user code) on which we will try to find a nested or wrapped or both RegionMovedException
source - server that is the source of the location update.
tableName - the table name
rowkey - the row

updateCachedLocations

public void updateCachedLocations(byte[] tableName,
                                  byte[] rowkey,
                                  Object exception,
                                  HRegionLocation source)
Specified by:
updateCachedLocations in interface HConnection

processBatch

@Deprecated
public void processBatch(List<? extends Row> list,
                                    TableName tableName,
                                    ExecutorService pool,
                                    Object[] results)
                  throws IOException,
                         InterruptedException
Deprecated. 

Description copied from interface: HConnection
Process a mixed batch of Get, Put and Delete actions. All actions for a RegionServer are forwarded in one RPC call.

Specified by:
processBatch in interface HConnection
Parameters:
list - The collection of actions.
tableName - Name of the hbase table
pool - thread pool for parallel execution
results - An empty array, same size as list. If an exception is thrown, you can test here for partial results, and to determine which actions processed successfully.
Throws:
IOException - if there are problems talking to META. Per-item exceptions are stored in the results array.
InterruptedException

processBatch

@Deprecated
public void processBatch(List<? extends Row> list,
                                    byte[] tableName,
                                    ExecutorService pool,
                                    Object[] results)
                  throws IOException,
                         InterruptedException
Deprecated. 

Specified by:
processBatch in interface HConnection
Throws:
IOException
InterruptedException

processBatchCallback

@Deprecated
public <R> void processBatchCallback(List<? extends Row> list,
                                                TableName tableName,
                                                ExecutorService pool,
                                                Object[] results,
                                                Batch.Callback<R> callback)
                          throws IOException,
                                 InterruptedException
Deprecated. since 0.96 - Use HTable.processBatchCallback(java.util.List, java.lang.Object[], org.apache.hadoop.hbase.client.coprocessor.Batch.Callback) instead

Send the queries in parallel on the different region servers. Retries on failures. If the method returns it means that there is no error, and the 'results' array will contain no exception. On error, an exception is thrown, and the 'results' array will contain results and exceptions.

Specified by:
processBatchCallback in interface HConnection
Throws:
IOException
InterruptedException

processBatchCallback

@Deprecated
public <R> void processBatchCallback(List<? extends Row> list,
                                                byte[] tableName,
                                                ExecutorService pool,
                                                Object[] results,
                                                Batch.Callback<R> callback)
                          throws IOException,
                                 InterruptedException
Deprecated. 

Specified by:
processBatchCallback in interface HConnection
Throws:
IOException
InterruptedException

createAsyncProcess

protected <R> org.apache.hadoop.hbase.client.AsyncProcess createAsyncProcess(TableName tableName,
                                                                             ExecutorService pool,
                                                                             org.apache.hadoop.hbase.client.AsyncProcess.AsyncProcessCallback<R> callback,
                                                                             org.apache.hadoop.conf.Configuration conf)

getStatisticsTracker

public ServerStatisticTracker getStatisticsTracker()
Specified by:
getStatisticsTracker in interface HConnection
Returns:
the current statistics tracker associated with this connection

getBackoffPolicy

public ClientBackoffPolicy getBackoffPolicy()
Specified by:
getBackoffPolicy in interface HConnection
Returns:
the configured client backoff policy

setRegionCachePrefetch

public void setRegionCachePrefetch(TableName tableName,
                                   boolean enable)
Description copied from interface: HConnection
Enable or disable region cache prefetch for the table. It will be applied for the given table's all HTable instances within this connection. By default, the cache prefetch is enabled.

Specified by:
setRegionCachePrefetch in interface HConnection
Parameters:
tableName - name of table to configure.
enable - Set to true to enable region cache prefetch.

setRegionCachePrefetch

public void setRegionCachePrefetch(byte[] tableName,
                                   boolean enable)
Specified by:
setRegionCachePrefetch in interface HConnection

getRegionCachePrefetch

public boolean getRegionCachePrefetch(TableName tableName)
Description copied from interface: HConnection
Check whether region cache prefetch is enabled or not.

Specified by:
getRegionCachePrefetch in interface HConnection
Parameters:
tableName - name of table to check
Returns:
true if table's region cache prefetch is enabled. Otherwise it is disabled.

getRegionCachePrefetch

public boolean getRegionCachePrefetch(byte[] tableName)
Specified by:
getRegionCachePrefetch in interface HConnection

abort

public void abort(String msg,
                  Throwable t)
Description copied from interface: Abortable
Abort the server or client.

Specified by:
abort in interface Abortable
Parameters:
msg - Why we're aborting.
t - Throwable that caused abort. Can be null.

isClosed

public boolean isClosed()
Specified by:
isClosed in interface HConnection
Returns:
true if this connection is closed

isAborted

public boolean isAborted()
Description copied from interface: Abortable
Check if the server or client was aborted.

Specified by:
isAborted in interface Abortable
Returns:
true if the server or client was aborted, false otherwise

getCurrentNrHRS

public int getCurrentNrHRS()
                    throws IOException
Specified by:
getCurrentNrHRS in interface HConnection
Returns:
the number of region servers that are currently running
Throws:
IOException - if a remote or network exception occurs

close

public void close()
Specified by:
close in interface Closeable

finalize

protected void finalize()
                 throws Throwable
Close the connection for good, regardless of what the current value of refCount is. Ideally, refCount should be zero at this point, which would be the case if all of its consumers close the connection. However, on the off chance that someone is unable to close the connection, perhaps because it bailed out prematurely, the method below will ensure that this HConnection instance is cleaned up. Caveat: The JVM may take an unknown amount of time to call finalize on an unreachable object, so our hope is that every consumer cleans up after itself, like any good citizen.

Overrides:
finalize in class Object
Throws:
Throwable

listTables

public HTableDescriptor[] listTables()
                              throws IOException
Description copied from interface: HConnection
List all the userspace tables. In other words, scan the hbase:meta table. If we wanted this to be really fast, we could implement a special catalog table that just contains table names and their descriptors. Right now, it only exists as part of the hbase:meta table's region info.

Specified by:
listTables in interface HConnection
Returns:
- returns an array of HTableDescriptors
Throws:
IOException - if a remote or network exception occurs

getTableNames

public String[] getTableNames()
                       throws IOException
Specified by:
getTableNames in interface HConnection
Throws:
IOException

listTableNames

public TableName[] listTableNames()
                           throws IOException
Specified by:
listTableNames in interface HConnection
Throws:
IOException

getHTableDescriptorsByTableName

public HTableDescriptor[] getHTableDescriptorsByTableName(List<TableName> tableNames)
                                                   throws IOException
Specified by:
getHTableDescriptorsByTableName in interface HConnection
Parameters:
tableNames - List of table names
Returns:
HTD[] table metadata
Throws:
IOException - if a remote or network exception occurs

getHTableDescriptors

public HTableDescriptor[] getHTableDescriptors(List<String> names)
                                        throws IOException
Specified by:
getHTableDescriptors in interface HConnection
Throws:
IOException

getNonceGenerator

public NonceGenerator getNonceGenerator()
Specified by:
getNonceGenerator in interface HConnection
Returns:
Nonce generator for this HConnection; may be null if disabled in configuration.

getHTableDescriptor

public HTableDescriptor getHTableDescriptor(TableName tableName)
                                     throws IOException
Connects to the master to get the table descriptor.

Specified by:
getHTableDescriptor in interface HConnection
Parameters:
tableName - table name
Returns:
Throws:
IOException - if the connection to master fails or if the table is not found.

getHTableDescriptor

public HTableDescriptor getHTableDescriptor(byte[] tableName)
                                     throws IOException
Specified by:
getHTableDescriptor in interface HConnection
Throws:
IOException

hasCellBlockSupport

public boolean hasCellBlockSupport()
Returns:
true when this connection uses a Codec and so supports cell blocks.


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.