当前位置: 首页>>代码示例>>Java>>正文


Java HRegionLocation.getHostname方法代码示例

本文整理汇总了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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:HBaseFsck.java

示例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;
  }
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:HTableUtil.java

示例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;
  }
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:HTableUtil.java


注:本文中的org.apache.hadoop.hbase.HRegionLocation.getHostname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。