本文整理汇总了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")));
}
示例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")));
}
示例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")));
}
示例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")));
}
示例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")));
}
示例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")));
}