use of org.apache.hadoop.hbase.MiniHBaseCluster in project cdap by caskdata.
the class HBase96Test method forEachRegion.
@Override
public <T> Map<byte[], T> forEachRegion(byte[] tableName, Function<HRegion, T> function) {
MiniHBaseCluster hbaseCluster = getHBaseCluster();
Map<byte[], T> results = new TreeMap<>(Bytes.BYTES_COMPARATOR);
// make sure consumer config cache is updated
for (JVMClusterUtil.RegionServerThread t : hbaseCluster.getRegionServerThreads()) {
List<HRegion> serverRegions = t.getRegionServer().getOnlineRegions(TableName.valueOf(tableName));
for (HRegion region : serverRegions) {
results.put(region.getRegionName(), function.apply(region));
}
}
return results;
}
Aggregations