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


Java AdminStates.valueOf方法代码示例

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


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

示例1: toDatanodeInfo

import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates; //导入方法依赖的package包/类
/** Convert a Json map to an DatanodeInfo object. */
private static DatanodeInfo toDatanodeInfo(final Map<?, ?> m) {
  if (m == null) {
    return null;
  }

  return new DatanodeInfo(
      (String)m.get("ipAddr"),
      (String)m.get("hostName"),
      (String)m.get("storageID"),
      (int)(long)(Long)m.get("xferPort"),
      (int)(long)(Long)m.get("infoPort"),
      (int)(long)(Long)m.get("ipcPort"),

      (Long)m.get("capacity"),
      (Long)m.get("dfsUsed"),
      (Long)m.get("remaining"),
      (Long)m.get("blockPoolUsed"),
      (Long)m.get("lastUpdate"),
      (int)(long)(Long)m.get("xceiverCount"),
      (String)m.get("networkLocation"),
      AdminStates.valueOf((String)m.get("adminState")));
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:24,代码来源:JsonUtil.java

示例2: toDatanodeInfo

import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates; //导入方法依赖的package包/类
/**
 * Convert a Json map to an DatanodeInfo object.
 */
private static DatanodeInfo toDatanodeInfo(final Map<?, ?> m) {
  if (m == null) {
    return null;
  }

  return new DatanodeInfo((String) m.get("ipAddr"),
      (String) m.get("hostName"), (String) m.get("storageID"),
      (int) (long) (Long) m.get("xferPort"),
      (int) (long) (Long) m.get("infoPort"),
      (int) (long) (Long) m.get("ipcPort"),

      (Long) m.get("capacity"), (Long) m.get("dfsUsed"),
      (Long) m.get("remaining"), (Long) m.get("blockPoolUsed"),
      (Long) m.get("lastUpdate"), (int) (long) (Long) m.get("xceiverCount"),
      (String) m.get("networkLocation"),
      AdminStates.valueOf((String) m.get("adminState")));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:21,代码来源:JsonUtil.java

示例3: toDatanodeInfo

import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates; //导入方法依赖的package包/类
/** Convert a Json map to an DatanodeInfo object. */
private static DatanodeInfo toDatanodeInfo(final Map<?, ?> m) {
  if (m == null) {
    return null;
  }

  return new DatanodeInfo(
      (String)m.get("ipAddr"),
      (String)m.get("hostName"),
      (String)m.get("storageID"),
      (int)(long)(Long)m.get("xferPort"),
      (int)(long)(Long)m.get("infoPort"),
      (int)(long)(Long)m.get("infoSecurePort"),
      (int)(long)(Long)m.get("ipcPort"),

      (Long)m.get("capacity"),
      (Long)m.get("dfsUsed"),
      (Long)m.get("remaining"),
      (Long)m.get("blockPoolUsed"),
      (Long)m.get("lastUpdate"),
      (int)(long)(Long)m.get("xceiverCount"),
      (String)m.get("networkLocation"),
      AdminStates.valueOf((String)m.get("adminState")));
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:25,代码来源:JsonUtil.java

示例4: toDatanodeInfo

import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates; //导入方法依赖的package包/类
/** Convert a Json map to an DatanodeInfo object. */
private static DatanodeInfo toDatanodeInfo(final Map<?, ?> m) {
  if (m == null) {
    return null;
  }

  return new DatanodeInfo(
      (String)m.get("name"),
      (String)m.get("storageID"),
      (int)(long)(Long)m.get("infoPort"),
      (int)(long)(Long)m.get("ipcPort"),

      (Long)m.get("capacity"),
      (Long)m.get("dfsUsed"),
      (Long)m.get("remaining"),
      (Long)m.get("lastUpdate"),
      (int)(long)(Long)m.get("xceiverCount"),
      (String)m.get("networkLocation"),
      (String)m.get("hostName"),
      AdminStates.valueOf((String)m.get("adminState")));
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:22,代码来源:JsonUtil.java

示例5: toDatanodeInfo

import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates; //导入方法依赖的package包/类
/** Convert a Json map to an DatanodeInfo object. */
static DatanodeInfo toDatanodeInfo(final Map<?, ?> m)
    throws IOException {
  if (m == null) {
    return null;
  }

  // ipAddr and xferPort are the critical fields for accessing data.
  // If any one of the two is missing, an exception needs to be thrown.

  // Handle the case of old servers (1.x, 0.23.x) sending 'name' instead
  // of ipAddr and xferPort.
  int xferPort = getInt(m, "xferPort", -1);
  Object tmpValue = m.get("ipAddr");
  String ipAddr = (tmpValue == null) ? null : (String)tmpValue;
  if (ipAddr == null) {
    tmpValue = m.get("name");
    if (tmpValue != null) {
      String name = (String)tmpValue;
      int colonIdx = name.indexOf(':');
      if (colonIdx > 0) {
        ipAddr = name.substring(0, colonIdx);
        xferPort = Integer.parseInt(name.substring(colonIdx +1));
      } else {
        throw new IOException(
            "Invalid value in server response: name=[" + name + "]");
      }
    } else {
      throw new IOException(
          "Missing both 'ipAddr' and 'name' in server response.");
    }
    // ipAddr is non-null & non-empty string at this point.
  }

  // Check the validity of xferPort.
  if (xferPort == -1) {
    throw new IOException(
        "Invalid or missing 'xferPort' in server response.");
  }

  // TODO: Fix storageID
  return new DatanodeInfo(
      ipAddr,
      (String)m.get("hostName"),
      (String)m.get("storageID"),
      xferPort,
      ((Number) m.get("infoPort")).intValue(),
      getInt(m, "infoSecurePort", 0),
      ((Number) m.get("ipcPort")).intValue(),

      getLong(m, "capacity", 0l),
      getLong(m, "dfsUsed", 0l),
      getLong(m, "remaining", 0l),
      getLong(m, "blockPoolUsed", 0l),
      getLong(m, "cacheCapacity", 0l),
      getLong(m, "cacheUsed", 0l),
      getLong(m, "lastUpdate", 0l),
      getLong(m, "lastUpdateMonotonic", 0l),
      getInt(m, "xceiverCount", 0),
      getString(m, "networkLocation", ""),
      AdminStates.valueOf(getString(m, "adminState", "NORMAL")));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:63,代码来源:JsonUtil.java

示例6: toDatanodeInfo

import org.apache.hadoop.hdfs.protocol.DatanodeInfo.AdminStates; //导入方法依赖的package包/类
/** Convert a Json map to an DatanodeInfo object. */
static DatanodeInfo toDatanodeInfo(final Map<?, ?> m)
    throws IOException {
  if (m == null) {
    return null;
  }

  // ipAddr and xferPort are the critical fields for accessing data.
  // If any one of the two is missing, an exception needs to be thrown.

  // Handle the case of old servers (1.x, 0.23.x) sending 'name' instead
  // of ipAddr and xferPort.
  Object tmpValue = m.get("ipAddr");
  String ipAddr = (tmpValue == null) ? null : (String)tmpValue;
  tmpValue = m.get("xferPort");
  int xferPort = (tmpValue == null) ? -1 : (int)(long)(Long)tmpValue;
  if (ipAddr == null) {
    tmpValue = m.get("name");
    if (tmpValue != null) {
      String name = (String)tmpValue;
      int colonIdx = name.indexOf(':');
      if (colonIdx > 0) {
        ipAddr = name.substring(0, colonIdx);
        xferPort = Integer.parseInt(name.substring(colonIdx +1));
      } else {
        throw new IOException(
            "Invalid value in server response: name=[" + name + "]");
      }
    } else {
      throw new IOException(
          "Missing both 'ipAddr' and 'name' in server response.");
    }
    // ipAddr is non-null & non-empty string at this point.
  }

  // Check the validity of xferPort.
  if (xferPort == -1) {
    throw new IOException(
        "Invalid or missing 'xferPort' in server response.");
  }

  // TODO: Fix storageID
  return new DatanodeInfo(
      ipAddr,
      (String)m.get("hostName"),
      (String)m.get("storageID"),
      xferPort,
      (int)(long)(Long)m.get("infoPort"),
      getInt(m, "infoSecurePort", 0),
      (int)(long)(Long)m.get("ipcPort"),

      getLong(m, "capacity", 0l),
      getLong(m, "dfsUsed", 0l),
      getLong(m, "remaining", 0l),
      getLong(m, "blockPoolUsed", 0l),
      getLong(m, "cacheCapacity", 0l),
      getLong(m, "cacheUsed", 0l),
      getLong(m, "lastUpdate", 0l),
      getInt(m, "xceiverCount", 0),
      getString(m, "networkLocation", ""),
      AdminStates.valueOf(getString(m, "adminState", "NORMAL")));
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:63,代码来源:JsonUtil.java


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