HConnection.getTable(String)
.@InterfaceAudience.Private @Deprecated public class HTablePool extends Object implements Closeable
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 Table.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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
Closes all the HTable instances , belonging to all tables in the table
pool.
|
void |
closeTablePool(byte[] tableName)
Deprecated.
|
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.
|
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)
config
- configurationmaxSize
- maximum number of references to keep for each tabletableFactory
- table factorypublic HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize, PoolMap.PoolType poolType)
config
- configurationmaxSize
- maximum number of references to keep for each tablepoolType
- pool type which is one of PoolMap.PoolType.Reusable
or
PoolMap.PoolType.ThreadLocal
public HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize, HTableInterfaceFactory tableFactory, PoolMap.PoolType poolType)
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
.config
- configurationmaxSize
- maximum number of references to keep for each tabletableFactory
- table factorypoolType
- pool type which is one of PoolMap.PoolType.Reusable
or
PoolMap.PoolType.ThreadLocal
public HTableInterface getTable(String tableName)
tableName
- table nameRuntimeException
- if there is a problem instantiating the HTablepublic HTableInterface getTable(byte[] tableName)
Create a new one if one is not available.
tableName
- table nameRuntimeException
- if there is a problem instantiating the HTablepublic void putTable(HTableInterface table) throws IOException
table
- the proxy table user got from poolIOException
protected HTableInterface createHTable(String tableName)
public void closeTablePool(String tableName) throws IOException
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
- IOException
public void closeTablePool(byte[] tableName) throws IOException
tableName
- IOException
public void close() throws IOException
Note: this is a 'shutdown' of all the table pools.
close
in interface Closeable
close
in interface AutoCloseable
IOException
public int getCurrentPoolSize(String tableName)
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.