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


Java ServerName.parseServerName方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.ServerName.parseServerName方法的典型用法代码示例。如果您正苦于以下问题:Java ServerName.parseServerName方法的具体用法?Java ServerName.parseServerName怎么用?Java ServerName.parseServerName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.ServerName的用法示例。


在下文中一共展示了ServerName.parseServerName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getServerNameFromWALDirectoryName

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
/**
 * This function returns region server name from a log file name which is in one of the following
 * formats:
 * <ul>
 *   <li>hdfs://&lt;name node&gt;/hbase/.logs/&lt;server name&gt;-splitting/...</li>
 *   <li>hdfs://&lt;name node&gt;/hbase/.logs/&lt;server name&gt;/...</li>
 * </ul>
 * @param logFile
 * @return null if the passed in logFile isn't a valid WAL file path
 */
public static ServerName getServerNameFromWALDirectoryName(Path logFile) {
  String logDirName = logFile.getParent().getName();
  // We were passed the directory and not a file in it.
  if (logDirName.equals(HConstants.HREGION_LOGDIR_NAME)) {
    logDirName = logFile.getName();
  }
  ServerName serverName = null;
  if (logDirName.endsWith(SPLITTING_EXT)) {
    logDirName = logDirName.substring(0, logDirName.length() - SPLITTING_EXT.length());
  }
  try {
    serverName = ServerName.parseServerName(logDirName);
  } catch (IllegalArgumentException ex) {
    serverName = null;
    LOG.warn("Cannot parse a server name from path=" + logFile + "; " + ex.getMessage());
  }
  if (serverName != null && serverName.getStartcode() < 0) {
    LOG.warn("Invalid log file path=" + logFile);
    serverName = null;
  }
  return serverName;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:DefaultWALProvider.java

示例2: nodeDeleted

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
@Override
public void nodeDeleted(String path) {
  if (path.startsWith(watcher.rsZNode)) {
    String serverName = ZKUtil.getNodeName(path);
    LOG.info("RegionServer ephemeral node deleted, processing expiration [" +
      serverName + "]");
    ServerName sn = ServerName.parseServerName(serverName);
    if (!serverManager.isServerOnline(sn)) {
      LOG.warn(serverName.toString() + " is not online or isn't known to the master."+
       "The latter could be caused by a DNS misconfiguration.");
      return;
    }
    remove(sn);
    this.serverManager.expireServer(sn);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:RegionServerTracker.java

示例3: getRegionServer

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
/**
 * Returns the {@link ServerName} from catalog table {@link Result}
 * where the region is transitioning. It should be the same as
 * {@link HRegionInfo#getServerName(Result)} if the server is at OPEN state.
 * @param r Result to pull the transitioning server name from
 * @return A ServerName instance or {@link HRegionInfo#getServerName(Result)}
 * if necessary fields not found or empty.
 */
static ServerName getRegionServer(final Result r, int replicaId) {
  Cell cell = r.getColumnLatestCell(HConstants.CATALOG_FAMILY, getServerNameColumn(replicaId));
  if (cell == null || cell.getValueLength() == 0) {
    RegionLocations locations = MetaTableAccessor.getRegionLocations(r);
    if (locations != null) {
      HRegionLocation location = locations.getRegionLocation(replicaId);
      if (location != null) {
        return location.getServerName();
      }
    }
    return null;
  }
  return ServerName.parseServerName(Bytes.toString(cell.getValueArray(),
    cell.getValueOffset(), cell.getValueLength()));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:RegionStateStore.java

示例4: getPreviouselyFailedMetaServersFromZK

import org.apache.hadoop.hbase.ServerName; //导入方法依赖的package包/类
/**
 * This function returns a set of region server names under hbase:meta recovering region ZK node
 * @return Set of meta server names which were recorded in ZK
 * @throws KeeperException
 */
private Set<ServerName> getPreviouselyFailedMetaServersFromZK() throws KeeperException {
  Set<ServerName> result = new HashSet<ServerName>();
  String metaRecoveringZNode = ZKUtil.joinZNode(zooKeeper.recoveringRegionsZNode,
    HRegionInfo.FIRST_META_REGIONINFO.getEncodedName());
  List<String> regionFailedServers = ZKUtil.listChildrenNoWatch(zooKeeper, metaRecoveringZNode);
  if (regionFailedServers == null) return result;

  for(String failedServer : regionFailedServers) {
    ServerName server = ServerName.parseServerName(failedServer);
    result.add(server);
  }
  return result;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:HMaster.java


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