本文整理汇总了Java中org.apache.hadoop.hbase.HBaseTestingUtility.waitFor方法的典型用法代码示例。如果您正苦于以下问题:Java HBaseTestingUtility.waitFor方法的具体用法?Java HBaseTestingUtility.waitFor怎么用?Java HBaseTestingUtility.waitFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.HBaseTestingUtility
的用法示例。
在下文中一共展示了HBaseTestingUtility.waitFor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateACLs
import org.apache.hadoop.hbase.HBaseTestingUtility; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private static void updateACLs(final HBaseTestingUtility util, Callable c) throws Exception {
// Get the current mtimes for all access controllers
final Map<AccessController,Long> oldMTimes = getAuthManagerMTimes(util.getHBaseCluster());
// Run the update action
c.call();
// Wait until mtimes for all access controllers have incremented
util.waitFor(WAIT_TIME, 100, new Predicate<IOException>() {
@Override
public boolean evaluate() throws IOException {
Map<AccessController,Long> mtimes = getAuthManagerMTimes(util.getHBaseCluster());
for (Map.Entry<AccessController,Long> e: mtimes.entrySet()) {
if (!oldMTimes.containsKey(e.getKey())) {
LOG.error("Snapshot of AccessController state does not include instance on region " +
e.getKey().getRegion().getRegionInfo().getRegionNameAsString());
// Error out the predicate, we will try again
return false;
}
long old = oldMTimes.get(e.getKey());
long now = e.getValue();
if (now <= old) {
LOG.info("AccessController on region " +
e.getKey().getRegion().getRegionInfo().getRegionNameAsString() +
" has not updated: mtime=" + now);
return false;
}
}
return true;
}
});
}
示例2: waitForTableToBeOnline
import org.apache.hadoop.hbase.HBaseTestingUtility; //导入方法依赖的package包/类
public static void waitForTableToBeOnline(final HBaseTestingUtility util,
final TableName tableName)
throws IOException, InterruptedException {
HRegionServer rs = util.getRSForFirstRegionInTable(tableName);
List<Region> onlineRegions = rs.getOnlineRegions(tableName);
for (Region region : onlineRegions) {
region.waitForFlushesAndCompactions();
}
// Wait up to 60 seconds for a table to be available.
util.waitFor(60000, util.predicateTableAvailable(tableName));
}