本文整理汇总了Java中org.apache.hadoop.hdfs.server.common.HdfsConstants.NodeType.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java NodeType.valueOf方法的具体用法?Java NodeType.valueOf怎么用?Java NodeType.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hdfs.server.common.HdfsConstants.NodeType
的用法示例。
在下文中一共展示了NodeType.valueOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFields
import org.apache.hadoop.hdfs.server.common.HdfsConstants.NodeType; //导入方法依赖的package包/类
/**
* Get common storage fields.
* Should be overloaded if additional fields need to be get.
*
* @param props
* @throws IOException
*/
protected void getFields(Properties props,
StorageDirectory sd
) throws IOException {
String sv, st, sid, sct;
sv = props.getProperty(LAYOUT_VERSION);
st = props.getProperty(STORAGE_TYPE);
sid = props.getProperty(NAMESPACE_ID);
sct = props.getProperty(CHECK_TIME);
if (sv == null || st == null || sid == null || sct == null)
throw new InconsistentFSStateException(sd.root,
"file " + STORAGE_FILE_VERSION + " is invalid.");
int rv = Integer.parseInt(sv);
NodeType rt = NodeType.valueOf(st);
int rid = Integer.parseInt(sid);
long rct = Long.parseLong(sct);
if (!storageType.equals(rt) ||
!((namespaceID == 0) || (rid == 0) || namespaceID == rid))
throw new InconsistentFSStateException(sd.root,
"is incompatible with others. " +
" namespaceID is " + namespaceID +
" and rid is " + rid + "," +
" storage type is " + storageType +
" but rt is " + rt);
if (rv < FSConstants.LAYOUT_VERSION) // future version
throw new IncorrectVersionException(rv, "storage directory "
+ sd.root.getCanonicalPath());
layoutVersion = rv;
storageType = rt;
namespaceID = rid;
cTime = rct;
}
示例2: setStorageType
import org.apache.hadoop.hdfs.server.common.HdfsConstants.NodeType; //导入方法依赖的package包/类
/** Validate and set storage type from {@link Properties}*/
protected void setStorageType(Properties props, StorageDirectory sd)
throws InconsistentFSStateException {
NodeType type = NodeType.valueOf(getProperty(props, sd, STORAGE_TYPE));
if (!storageType.equals(type)) {
throw new InconsistentFSStateException(sd.root,
"node type is incompatible with others.");
}
storageType = type;
}
示例3: getFields
import org.apache.hadoop.hdfs.server.common.HdfsConstants.NodeType; //导入方法依赖的package包/类
/**
* Get common storage fields.
* Should be overloaded if additional fields need to be get.
*
* @param props
* @throws IOException
*/
protected void getFields(Properties props,
StorageDirectory sd
) throws IOException {
String sv, st, sid, sct;
sv = props.getProperty("layoutVersion");
st = props.getProperty("storageType");
sid = props.getProperty("namespaceID");
sct = props.getProperty("cTime");
if (sv == null || st == null || sid == null || sct == null)
throw new InconsistentFSStateException(sd.root,
"file " + STORAGE_FILE_VERSION + " is invalid.");
int rv = Integer.parseInt(sv);
NodeType rt = NodeType.valueOf(st);
int rid = Integer.parseInt(sid);
long rct = Long.parseLong(sct);
if (!storageType.equals(rt) ||
!((namespaceID == 0) || (rid == 0) || namespaceID == rid))
throw new InconsistentFSStateException(sd.root,
"is incompatible with others.");
if (rv < FSConstants.LAYOUT_VERSION) // future version
throw new IncorrectVersionException(rv, "storage directory "
+ sd.root.getCanonicalPath());
layoutVersion = rv;
storageType = rt;
namespaceID = rid;
cTime = rct;
}