當前位置: 首頁>>代碼示例>>Java>>正文


Java Result.getNoVersionMap方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.Result.getNoVersionMap方法的典型用法代碼示例。如果您正苦於以下問題:Java Result.getNoVersionMap方法的具體用法?Java Result.getNoVersionMap怎麽用?Java Result.getNoVersionMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.Result的用法示例。


在下文中一共展示了Result.getNoVersionMap方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRegionLocations

import org.apache.hadoop.hbase.client.Result; //導入方法依賴的package包/類
/**
 * Returns an HRegionLocationList extracted from the result.
 * @return an HRegionLocationList containing all locations for the region range or null if
 *  we can't deserialize the result.
 */
public static RegionLocations getRegionLocations(final Result r) {
  if (r == null) return null;
  HRegionInfo regionInfo = getHRegionInfo(r, getRegionInfoColumn());
  if (regionInfo == null) return null;

  List<HRegionLocation> locations = new ArrayList<HRegionLocation>(1);
  NavigableMap<byte[],NavigableMap<byte[],byte[]>> familyMap = r.getNoVersionMap();

  locations.add(getRegionLocation(r, regionInfo, 0));

  NavigableMap<byte[], byte[]> infoMap = familyMap.get(getFamily());
  if (infoMap == null) return new RegionLocations(locations);

  // iterate until all serverName columns are seen
  int replicaId = 0;
  byte[] serverColumn = getServerColumn(replicaId);
  SortedMap<byte[], byte[]> serverMap = null;
  serverMap = infoMap.tailMap(serverColumn, false);

  if (serverMap.isEmpty()) return new RegionLocations(locations);

  for (Map.Entry<byte[], byte[]> entry : serverMap.entrySet()) {
    replicaId = parseReplicaIdFromServerColumn(entry.getKey());
    if (replicaId < 0) {
      break;
    }
    HRegionLocation location = getRegionLocation(r, regionInfo, replicaId);
    // In case the region replica is newly created, it's location might be null. We usually do not
    // have HRL's in RegionLocations object with null ServerName. They are handled as null HRLs.
    if (location == null || location.getServerName() == null) {
      locations.add(null);
    } else {
      locations.add(location);
    }
  }

  return new RegionLocations(locations);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:44,代碼來源:MetaTableAccessor.java


注:本文中的org.apache.hadoop.hbase.client.Result.getNoVersionMap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。