|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.client.HTablePool
public class HTablePool
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.
Once you are done with it, return it to the pool with 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 cluster to the cluster. See HConnectionManager
.
Constructor Summary | |
---|---|
HTablePool()
Default Constructor. |
|
HTablePool(org.apache.hadoop.conf.Configuration config,
int maxSize)
Constructor to set maximum versions and use the specified configuration. |
|
HTablePool(org.apache.hadoop.conf.Configuration config,
int maxSize,
HTableInterfaceFactory tableFactory)
|
Method Summary | |
---|---|
void |
closeTablePool(byte[] tableName)
See closeTablePool(String) . |
void |
closeTablePool(String tableName)
Closes all the HTable instances , belonging to the given table, in the table pool. |
protected HTableInterface |
createHTable(String tableName)
|
HTableInterface |
getTable(byte[] tableName)
Get a reference to the specified table from the pool. |
HTableInterface |
getTable(String tableName)
Get a reference to the specified table from the pool. |
void |
putTable(HTableInterface table)
Puts the specified HTable back into the pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HTablePool()
public HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize)
config
- configurationmaxSize
- maximum number of references to keep for each tablepublic HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize, HTableInterfaceFactory tableFactory)
Method Detail |
---|
public HTableInterface getTable(String tableName)
Create a new one if one is not available.
tableName
- table name
RuntimeException
- if there is a problem instantiating the HTablepublic HTableInterface getTable(byte[] tableName)
Create a new one if one is not available.
tableName
- table name
RuntimeException
- if there is a problem instantiating the HTablepublic void putTable(HTableInterface table)
If the pool already contains maxSize references to the table, then the table instance gets closed after flushing buffered edits.
table
- tableprotected HTableInterface createHTable(String tableName)
public void closeTablePool(String tableName)
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.
tableName
- public void closeTablePool(byte[] tableName)
closeTablePool(String)
.
tableName
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |