public static boolean tableRegionsOnline(Configuration conf, PTable table) {
HConnection hcon = null;
try {
hcon = HConnectionManager.getConnection(conf);
List<HRegionLocation> locations = hcon.locateRegions(table.getTableName().getBytes());
for (HRegionLocation loc : locations) {
HRegionInterface server = hcon.getHRegionConnection(
loc.getHostname(), loc.getPort());
server.getRegionInfo(loc.getRegionInfo().getRegionName());