org.apache.hadoop.hbase.client
Class HTablePool

java.lang.Object
  extended by org.apache.hadoop.hbase.client.HTablePool
All Implemented Interfaces:
Closeable

Deprecated. as of 0.98.1. See HConnection.getTable(String).

@InterfaceAudience.Private
@Deprecated
public class HTablePool
extends Object
implements Closeable

A simple pool of HTable instances. Each HTablePool acts as a pool for all tables. To use, instantiate an HTablePool and use getTable(String) to get an HTable from the pool. This method is not needed anymore, clients should call HTableInterface.close() rather than returning the tables to the pool Once you are done with it, close your instance of HTableInterface by calling HTableInterface.close() rather than returning the tables to the pool with (deprecated) putTable(HTableInterface).

A pool can be created with a maxSize which defines the most HTable references that will ever be retained for each table. Otherwise the default is Integer.MAX_VALUE.

Pool will manage its own connections to the cluster. See HConnectionManager.


Constructor Summary
HTablePool()
          Deprecated. Default Constructor.
HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize)
          Deprecated. Constructor to set maximum versions and use the specified configuration.
HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize, HTableInterfaceFactory tableFactory)
          Deprecated. Constructor to set maximum versions and use the specified configuration and table factory.
HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize, HTableInterfaceFactory tableFactory, PoolMap.PoolType poolType)
          Deprecated. Constructor to set maximum versions and use the specified configuration, table factory and pool type.
HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize, PoolMap.PoolType poolType)
          Deprecated. Constructor to set maximum versions and use the specified configuration and pool type.
 
Method Summary
 void close()
          Deprecated. Closes all the HTable instances , belonging to all tables in the table pool.
 void closeTablePool(byte[] tableName)
          Deprecated. See closeTablePool(String).
 void closeTablePool(String tableName)
          Deprecated. Closes all the HTable instances , belonging to the given table, in the table pool.
protected  HTableInterface createHTable(String tableName)
          Deprecated.  
 int getCurrentPoolSize(String tableName)
          Deprecated.  
 HTableInterface getTable(byte[] tableName)
          Deprecated. Get a reference to the specified table from the pool.
 HTableInterface getTable(String tableName)
          Deprecated. Get a reference to the specified table from the pool.
 void putTable(HTableInterface table)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTablePool

public HTablePool()
Deprecated. 
Default Constructor. Default HBaseConfiguration and no limit on pool size.


HTablePool

public HTablePool(org.apache.hadoop.conf.Configuration config,
                  int maxSize)
Deprecated. 
Constructor to set maximum versions and use the specified configuration.

Parameters:
config - configuration
maxSize - maximum number of references to keep for each table

HTablePool

public HTablePool(org.apache.hadoop.conf.Configuration config,
                  int maxSize,
                  HTableInterfaceFactory tableFactory)
Deprecated. 
Constructor to set maximum versions and use the specified configuration and table factory.

Parameters:
config - configuration
maxSize - maximum number of references to keep for each table
tableFactory - table factory

HTablePool

public HTablePool(org.apache.hadoop.conf.Configuration config,
                  int maxSize,
                  PoolMap.PoolType poolType)
Deprecated. 
Constructor to set maximum versions and use the specified configuration and pool type.

Parameters:
config - configuration
maxSize - maximum number of references to keep for each table
poolType - pool type which is one of PoolMap.PoolType.Reusable or PoolMap.PoolType.ThreadLocal

HTablePool

public HTablePool(org.apache.hadoop.conf.Configuration config,
                  int maxSize,
                  HTableInterfaceFactory tableFactory,
                  PoolMap.PoolType poolType)
Deprecated. 
Constructor to set maximum versions and use the specified configuration, table factory and pool type. The HTablePool supports the PoolMap.PoolType.Reusable and PoolMap.PoolType.ThreadLocal. If the pool type is null or not one of those two values, then it will default to PoolMap.PoolType.Reusable.

Parameters:
config - configuration
maxSize - maximum number of references to keep for each table
tableFactory - table factory
poolType - pool type which is one of PoolMap.PoolType.Reusable or PoolMap.PoolType.ThreadLocal
Method Detail

getTable

public HTableInterface getTable(String tableName)
Deprecated. 
Get a reference to the specified table from the pool.

Parameters:
tableName - table name
Returns:
a reference to the specified table
Throws:
RuntimeException - if there is a problem instantiating the HTable

getTable

public HTableInterface getTable(byte[] tableName)
Deprecated. 
Get a reference to the specified table from the pool.

Create a new one if one is not available.

Parameters:
tableName - table name
Returns:
a reference to the specified table
Throws:
RuntimeException - if there is a problem instantiating the HTable

putTable

public void putTable(HTableInterface table)
              throws IOException
Deprecated. 

This method is not needed anymore, clients should call HTableInterface.close() rather than returning the tables to the pool

Parameters:
table - the proxy table user got from pool
Throws:
IOException

createHTable

protected HTableInterface createHTable(String tableName)
Deprecated. 

closeTablePool

public void closeTablePool(String tableName)
                    throws IOException
Deprecated. 
Closes all the HTable instances , belonging to the given table, in the table pool.

Note: this is a 'shutdown' of the given table pool and different from putTable(HTableInterface), that is used to return the table instance to the pool for future re-use.

Parameters:
tableName -
Throws:
IOException

closeTablePool

public void closeTablePool(byte[] tableName)
                    throws IOException
Deprecated. 
See closeTablePool(String).

Parameters:
tableName -
Throws:
IOException

close

public void close()
           throws IOException
Deprecated. 
Closes all the HTable instances , belonging to all tables in the table pool.

Note: this is a 'shutdown' of all the table pools.

Specified by:
close in interface Closeable
Throws:
IOException

getCurrentPoolSize

public int getCurrentPoolSize(String tableName)
Deprecated. 


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.