• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DataNodeLayoutVersion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hdfs.server.datanode.DataNodeLayoutVersion的典型用法代码示例。如果您正苦于以下问题:Java DataNodeLayoutVersion类的具体用法?Java DataNodeLayoutVersion怎么用?Java DataNodeLayoutVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataNodeLayoutVersion类属于org.apache.hadoop.hdfs.server.datanode包,在下文中一共展示了DataNodeLayoutVersion类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addDataNodeLayoutVersion

import org.apache.hadoop.hdfs.server.datanode.DataNodeLayoutVersion; //导入依赖的package包/类
public static void addDataNodeLayoutVersion(final int lv, final String description)
    throws NoSuchFieldException, IllegalAccessException {
  Preconditions.checkState(lv < DataNodeLayoutVersion.CURRENT_LAYOUT_VERSION);

  // Override {@link DataNodeLayoutVersion#CURRENT_LAYOUT_VERSION} via reflection.
  Field modifiersField = Field.class.getDeclaredField("modifiers");
  modifiersField.setAccessible(true);
  Field field = DataNodeLayoutVersion.class.getField("CURRENT_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Override {@link HdfsConstants#DATANODE_LAYOUT_VERSION}
  field = HdfsConstants.class.getField("DATANODE_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Inject the feature into the FEATURES map.
  final LayoutVersion.FeatureInfo featureInfo =
      new LayoutVersion.FeatureInfo(lv, lv + 1, description, false);
  final LayoutVersion.LayoutFeature feature =
      new LayoutVersion.LayoutFeature() {
    @Override
    public LayoutVersion.FeatureInfo getInfo() {
      return featureInfo;
    }
  };

  // Update the FEATURES map with the new layout version.
  LayoutVersion.updateMap(DataNodeLayoutVersion.FEATURES,
                          new LayoutVersion.LayoutFeature[] { feature });
}
 
开发者ID:naver,项目名称:hadoop,代码行数:34,代码来源:DFSTestUtil.java


示例2: testDataNodeFeature

import org.apache.hadoop.hdfs.server.datanode.DataNodeLayoutVersion; //导入依赖的package包/类
/**
 * Test to make sure DataNode.Feature support previous features
 */
@Test
public void testDataNodeFeature() {
  final LayoutFeature first = DataNodeLayoutVersion.Feature.FIRST_LAYOUT; 
  assertTrue(DataNodeLayoutVersion.supports(LAST_NON_RESERVED_COMMON_FEATURE,
      first.getInfo().getLayoutVersion()));
  assertEquals(LAST_COMMON_FEATURE.getInfo().getLayoutVersion() - 1,
      first.getInfo().getLayoutVersion());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestLayoutVersion.java


示例3: createBlockPoolVersionFile

import org.apache.hadoop.hdfs.server.datanode.DataNodeLayoutVersion; //导入依赖的package包/类
public static void createBlockPoolVersionFile(File bpDir,
    StorageInfo version, String bpid) throws IOException {
  // Create block pool version files
  if (DataNodeLayoutVersion.supports(
      LayoutVersion.Feature.FEDERATION, version.layoutVersion)) {
    File bpCurDir = new File(bpDir, Storage.STORAGE_DIR_CURRENT);
    BlockPoolSliceStorage bpStorage = new BlockPoolSliceStorage(version,
        bpid);
    File versionFile = new File(bpCurDir, "VERSION");
    StorageDirectory sd = new StorageDirectory(bpDir);
    bpStorage.writeProperties(versionFile, sd);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:UpgradeUtilities.java


示例4: addDataNodeLayoutVersion

import org.apache.hadoop.hdfs.server.datanode.DataNodeLayoutVersion; //导入依赖的package包/类
public static void addDataNodeLayoutVersion(final int lv, final String description)
    throws NoSuchFieldException, IllegalAccessException {
  Preconditions.checkState(lv < DataNodeLayoutVersion.CURRENT_LAYOUT_VERSION);

  // Override {@link DataNodeLayoutVersion#CURRENT_LAYOUT_VERSION} via reflection.
  Field modifiersField = Field.class.getDeclaredField("modifiers");
  modifiersField.setAccessible(true);
  Field field = DataNodeLayoutVersion.class.getField("CURRENT_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  field = HdfsServerConstants.class.getField("DATANODE_LAYOUT_VERSION");
  field.setAccessible(true);
  modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
  field.setInt(null, lv);

  // Inject the feature into the FEATURES map.
  final LayoutVersion.FeatureInfo featureInfo =
      new LayoutVersion.FeatureInfo(lv, lv + 1, description, false);
  final LayoutVersion.LayoutFeature feature =
      new LayoutVersion.LayoutFeature() {
    @Override
    public LayoutVersion.FeatureInfo getInfo() {
      return featureInfo;
    }
  };

  // Update the FEATURES map with the new layout version.
  LayoutVersion.updateMap(DataNodeLayoutVersion.FEATURES,
                          new LayoutVersion.LayoutFeature[] { feature });
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:DFSTestUtil.java


示例5: getServiceLayoutFeatureMap

import org.apache.hadoop.hdfs.server.datanode.DataNodeLayoutVersion; //导入依赖的package包/类
public Map<Integer, SortedSet<LayoutFeature>> getServiceLayoutFeatureMap() {
  return storageType == NodeType.DATA_NODE? DataNodeLayoutVersion.FEATURES
      : NameNodeLayoutVersion.FEATURES;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:StorageInfo.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SourceExtractor类代码示例发布时间:2022-05-23
下一篇:
Java X509Util类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap