@Test public void testCloseTablePool() throws IOException { HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 4); HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration()); if (admin.tableExists(TABLENAME)) { admin.disableTable(TABLENAME); admin.deleteTable(TABLENAME); } HTableDescriptor tableDescriptor = new HTableDescriptor(TABLENAME); tableDescriptor.addFamily(new HColumnDescriptor("randomFamily")); admin.createTable(tableDescriptor); HTableInterface[] tables = new HTableInterface[4]; for (int i = 0; i < 4; ++i ) { tables[i] = pool.getTable(TABLENAME); } pool.closeTablePool(TABLENAME); for (int i = 0; i < 4; ++i ) { pool.putTable(tables[i]); } Assert.assertEquals(4, pool.getCurrentPoolSize(Bytes.toString(TABLENAME))); pool.closeTablePool(TABLENAME); Assert.assertEquals(0, pool.getCurrentPoolSize(Bytes.toString(TABLENAME))); }
public void closeTablePool(final String tableName) { Queue<HTableInterface> queue = tables.get(tableName); synchronized (queue) { HTableInterface table = queue.poll(); while (table != null) { this.tableFactory.releaseHTableInterface(table); table = queue.poll(); } } HConnectionManager.deleteConnection(this.config, true); }
HTablePool { public void closeTablePool(final String tableName) { Queue<HTableInterface> queue = tables.get(tableName); synchronized (queue) { HTableInterface table = queue.poll(); while (table != null) { this.tableFactory.releaseHTableInterface(table); table = queue.poll(); } } HConnectionManager.deleteConnection(this.config, true); } }
HTablePool { public void closeTablePool(final String tableName) { Queue<HTableInterface> queue = tables.get(tableName); synchronized (queue) { HTableInterface table = queue.poll(); while (table != null) { this.tableFactory.releaseHTableInterface(table); table = queue.poll(); } } HConnectionManager.deleteConnection(this.config, true); } HTablePool();  HTablePool(final Configuration config, final int maxSize);  HTablePool(final Configuration config, final int maxSize,
      final HTableInterfaceFactory tableFactory); }
HTablePool { public void closeTablePool(final String tableName) { Queue<HTableInterface> queue = tables.get(tableName); synchronized (queue) { HTableInterface table = queue.poll(); while (table != null) { this.tableFactory.releaseHTableInterface(table); table = queue.poll(); } } HConnectionManager.deleteConnection(this.config, true); } HTablePool();  HTablePool(final Configuration config, final int maxSize);  HTablePool(final Configuration config, final int maxSize,
      final HTableInterfaceFactory tableFactory); HTableInterface getTable(String tableName); HTableInterface getTable(byte [] tableName); void putTable(HTableInterface table); void closeTablePool(final String tableName); void closeTablePool(final byte[] tableName); }
HTablePool { public void closeTablePool(final String tableName) { Queue<HTableInterface> queue = tables.get(tableName); synchronized (queue) { HTableInterface table = queue.poll(); while (table != null) { this.tableFactory.releaseHTableInterface(table); table = queue.poll(); } } HConnectionManager.deleteConnection(this.config, true); } HTablePool();  HTablePool(final Configuration config, final int maxSize);  HTablePool(final Configuration config, final int maxSize,
      final HTableInterfaceFactory tableFactory); HTableInterface getTable(String tableName); HTableInterface getTable(byte [] tableName); void putTable(HTableInterface table); void closeTablePool(final String tableName); void closeTablePool(final byte[] tableName);  }