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


Java NodeType.valueOf方法代码示例

本文整理汇总了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;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:39,代码来源:Storage.java

示例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;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:11,代码来源:Storage.java

示例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;
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:35,代码来源:Storage.java


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