Announcement Announcement Module
Collapse
No announcement yet.
Hbase connections pool Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hbase connections pool

    Hi all
    I have problem with time connect to hbase. I want HTablePool

    Besides the template, the package offers support for automatically binding HBase table to the current thread through HbaseInterceptor and HbaseSynchronizationManager. That is, each class that performs DAO operations on HBase can be wrapped by HbaseInterceptor so that each table in use, once found, is bound to the thread so any subsequent call to it avoids the lookup. Once the call ends, the table is automatically closed so there is no leakage between requests. Please refer to the Javadocs for more information.
    I spend a lot of time to reopen connect.

    how can I get the template to work with a pool?

    I can write my Interceptor that don't releaseTable. And releaseTable Pre destroy. But this hack.

  • #2
    Or I can write my implements HTableInterfaceFactory.

    public class HTableFactory implements HTableInterfaceFactory {
    private HTablePool hTablePool;
    private Configuration config;
    private int poolSize;

    @PostConstruct
    public void init() {
    this.hTablePool = new HTablePool(config, poolSize);
    }

    @Override
    public HTableInterface createHTableInterface(Configuration config, byte[] tableName) {
    return hTablePool.getTable(tableName);
    }

    @Override
    public void releaseHTableInterface(HTableInterface table) throws IOException {
    table.close();
    }

    public void destroy() throws IOException {
    hTablePool.close();
    }

    public void setConfig(Configuration config) {
    this.config = config;
    }

    public void setPoolSize(String poolSize) {
    this.poolSize = Integer.parseInt(poolSize);
    }
    }

    I think that something like this is to enter the framework
    Last edited by Yura Vladimirov; Feb 27th, 2013, 10:36 AM.

    Comment

    Working...
    X