本文整理汇总了Java中org.apache.hadoop.hbase.HRegionLocation.getHostname方法的典型用法代码示例。如果您正苦于以下问题:Java HRegionLocation.getHostname方法的具体用法?Java HRegionLocation.getHostname怎么用?Java HRegionLocation.getHostname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.HRegionLocation
的用法示例。
在下文中一共展示了HRegionLocation.getHostname方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recordMetaRegion
import org.apache.hadoop.hbase.HRegionLocation; //导入方法依赖的package包/类
/**
* Record the location of the hbase:meta region as found in ZooKeeper.
*/
private boolean recordMetaRegion() throws IOException {
RegionLocations rl = ((ClusterConnection)connection).locateRegion(TableName.META_TABLE_NAME,
HConstants.EMPTY_START_ROW, false, false);
if (rl == null) {
errors.reportError(ERROR_CODE.NULL_META_REGION,
"META region or some of its attributes are null.");
return false;
}
for (HRegionLocation metaLocation : rl.getRegionLocations()) {
// Check if Meta region is valid and existing
if (metaLocation == null || metaLocation.getRegionInfo() == null ||
metaLocation.getHostname() == null) {
errors.reportError(ERROR_CODE.NULL_META_REGION,
"META region or some of its attributes are null.");
return false;
}
ServerName sn = metaLocation.getServerName();
MetaEntry m = new MetaEntry(metaLocation.getRegionInfo(), sn, EnvironmentEdgeManager.currentTime());
HbckInfo hbckInfo = regionInfoMap.get(metaLocation.getRegionInfo().getEncodedName());
if (hbckInfo == null) {
regionInfoMap.put(metaLocation.getRegionInfo().getEncodedName(), new HbckInfo(m));
} else {
hbckInfo.metaEntry = m;
}
}
return true;
}
示例2: createRsPutMap
import org.apache.hadoop.hbase.HRegionLocation; //导入方法依赖的package包/类
private static Map<String,List<Put>> createRsPutMap(RegionLocator htable, List<Put> puts) throws IOException {
Map<String, List<Put>> putMap = new HashMap<String, List<Put>>();
for (Put put: puts) {
HRegionLocation rl = htable.getRegionLocation( put.getRow() );
String hostname = rl.getHostname();
List<Put> recs = putMap.get( hostname);
if (recs == null) {
recs = new ArrayList<Put>(INITIAL_LIST_SIZE);
putMap.put( hostname, recs);
}
recs.add(put);
}
return putMap;
}
示例3: createRsRowMap
import org.apache.hadoop.hbase.HRegionLocation; //导入方法依赖的package包/类
private static Map<String,List<Row>> createRsRowMap(RegionLocator htable, List<Row> rows) throws IOException {
Map<String, List<Row>> rowMap = new HashMap<String, List<Row>>();
for (Row row: rows) {
HRegionLocation rl = htable.getRegionLocation( row.getRow() );
String hostname = rl.getHostname();
List<Row> recs = rowMap.get( hostname);
if (recs == null) {
recs = new ArrayList<Row>(INITIAL_LIST_SIZE);
rowMap.put( hostname, recs);
}
recs.add(row);
}
return rowMap;
}