Examples of HTableFactory


Examples of com.salesforce.hbase.index.table.HTableFactory

public class TestCachingHTableFactory {

  @Test
  public void testCacheCorrectlyExpiresTable() throws Exception {
    // setup the mocks for the tables we will request
    HTableFactory delegate = Mockito.mock(HTableFactory.class);
    ImmutableBytesPtr t1 = new ImmutableBytesPtr(Bytes.toBytes("t1"));
    ImmutableBytesPtr t2 = new ImmutableBytesPtr(Bytes.toBytes("t2"));
    ImmutableBytesPtr t3 = new ImmutableBytesPtr(Bytes.toBytes("t3"));
    HTableInterface table1 = Mockito.mock(HTableInterface.class);
    HTableInterface table2 = Mockito.mock(HTableInterface.class);
    HTableInterface table3 = Mockito.mock(HTableInterface.class);
    Mockito.when(delegate.getTable(t1)).thenReturn(table1);
    Mockito.when(delegate.getTable(t2)).thenReturn(table2);
    Mockito.when(delegate.getTable(t3)).thenReturn(table3);
   
    // setup our factory with a cache size of 2
    CachingHTableFactory factory = new CachingHTableFactory(delegate, 2);
    factory.getTable(t1);
    factory.getTable(t2);
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTableFactory

  public HBaseDataModel(String zkConnect, String tableName) throws IOException {
    log.info("Using HBase table {}", tableName);
    Configuration conf = HBaseConfiguration.create();
    conf.set("hbase.zookeeper.quorum", zkConnect);
    HTableFactory tableFactory = new HTableFactory();
    this.pool = new HTablePool(conf, 8, tableFactory);
    this.tableName = tableName;

    bootstrap(conf);
    // Warm the cache
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTableFactory

      final UserProvider userProvider) throws IOException {
    int cleanInterval = conf.getInt(CLEANUP_INTERVAL, 10 * 1000);
    int maxIdleTime = conf.getInt(MAX_IDLETIME, 10 * 60 * 1000);
    connectionCache = new ConnectionCache(
      conf, userProvider, cleanInterval, maxIdleTime);
    tableFactory = new HTableFactory() {
      @Override
      public HTableInterface createHTableInterface(Configuration config,
          byte[] tableName) {
        try {
          return connectionCache.getTable(Bytes.toString(tableName));
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTableFactory

      final UserProvider userProvider) throws IOException {
    int cleanInterval = conf.getInt(CLEANUP_INTERVAL, 10 * 1000);
    int maxIdleTime = conf.getInt(MAX_IDLETIME, 10 * 60 * 1000);
    connectionCache = new ConnectionCache(
      conf, userProvider, cleanInterval, maxIdleTime);
    tableFactory = new HTableFactory() {
      @Override
      public HTableInterface createHTableInterface(Configuration config,
          byte[] tableName) {
        try {
          return connectionCache.getTable(Bytes.toString(tableName));
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTableFactory

            final HaeinsaTableIfaceFactory tableFactory, PoolType poolType) {
        // Make a new configuration instance so I can safely cleanup when
        // done with the pool.
        this.config = config == null ? new Configuration() : config;
        this.maxSize = maxSize;
        this.tableFactory = tableFactory == null ? new DefaultHaeinsaTableIfaceFactory(new HTableFactory()) : tableFactory;
        if (poolType == null) {
            this.poolType = PoolType.Reusable;
        } else {
            switch (poolType) {
            case Reusable:
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTableFactory

      final UserProvider userProvider) throws IOException {
    int cleanInterval = conf.getInt(CLEANUP_INTERVAL, 10 * 1000);
    int maxIdleTime = conf.getInt(MAX_IDLETIME, 10 * 60 * 1000);
    connectionCache = new ConnectionCache(
      conf, userProvider, cleanInterval, maxIdleTime);
    tableFactory = new HTableFactory() {
      @Override
      public HTableInterface createHTableInterface(Configuration config,
          byte[] tableName) {
        try {
          return connectionCache.getTable(Bytes.toString(tableName));
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTableFactory

  public HBaseDataModel(String zkConnect, String tableName) throws IOException {
    log.info("Using HBase table {}", tableName);
    Configuration conf = HBaseConfiguration.create();
    conf.set("hbase.zookeeper.quorum", zkConnect);
    HTableFactory tableFactory = new HTableFactory();
    this.pool = new HTablePool(conf, 8, tableFactory);
    this.tableName = tableName;

    bootstrap(conf);
    // Warm the cache
View Full Code Here

Examples of org.apache.hbase.index.table.HTableFactory

public class TestCachingHTableFactory {

  @Test
  public void testCacheCorrectlyExpiresTable() throws Exception {
    // setup the mocks for the tables we will request
    HTableFactory delegate = Mockito.mock(HTableFactory.class);
    ImmutableBytesPtr t1 = new ImmutableBytesPtr(Bytes.toBytes("t1"));
    ImmutableBytesPtr t2 = new ImmutableBytesPtr(Bytes.toBytes("t2"));
    ImmutableBytesPtr t3 = new ImmutableBytesPtr(Bytes.toBytes("t3"));
    HTableInterface table1 = Mockito.mock(HTableInterface.class);
    HTableInterface table2 = Mockito.mock(HTableInterface.class);
    HTableInterface table3 = Mockito.mock(HTableInterface.class);
    Mockito.when(delegate.getTable(t1)).thenReturn(table1);
    Mockito.when(delegate.getTable(t2)).thenReturn(table2);
    Mockito.when(delegate.getTable(t3)).thenReturn(table3);
   
    // setup our factory with a cache size of 2
    CachingHTableFactory factory = new CachingHTableFactory(delegate, 2);
    factory.getTable(t1);
    factory.getTable(t2);
View Full Code Here

Examples of org.apache.phoenix.hbase.index.table.HTableFactory

public class TestCachingHTableFactory {

  @Test
  public void testCacheCorrectlyExpiresTable() throws Exception {
    // setup the mocks for the tables we will request
    HTableFactory delegate = Mockito.mock(HTableFactory.class);
    ImmutableBytesPtr t1 = new ImmutableBytesPtr(Bytes.toBytes("t1"));
    ImmutableBytesPtr t2 = new ImmutableBytesPtr(Bytes.toBytes("t2"));
    ImmutableBytesPtr t3 = new ImmutableBytesPtr(Bytes.toBytes("t3"));
    HTableInterface table1 = Mockito.mock(HTableInterface.class);
    HTableInterface table2 = Mockito.mock(HTableInterface.class);
    HTableInterface table3 = Mockito.mock(HTableInterface.class);
    Mockito.when(delegate.getTable(t1)).thenReturn(table1);
    Mockito.when(delegate.getTable(t2)).thenReturn(table2);
    Mockito.when(delegate.getTable(t3)).thenReturn(table3);
   
    // setup our factory with a cache size of 2
    CachingHTableFactory factory = new CachingHTableFactory(delegate, 2);
    factory.getTable(t1);
    factory.getTable(t2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.