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

Java Version类代码示例

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

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



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

示例1: checkVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
/**
 * 1) Versioning scheme: major.minor. For e.g. 1.0, 1.1, 1.2...1.25, 2.0 etc.
 * 2) Any incompatible change of state-store is a major upgrade, and any
 *    compatible change of state-store is a minor upgrade.
 * 3) Within a minor upgrade, say 1.1 to 1.2:
 *    overwrite the version info and proceed as normal.
 * 4) Within a major upgrade, say 1.2 to 2.0:
 *    throw exception and indicate user to use a separate upgrade tool to
 *    upgrade NM state or remove incompatible old state.
 */
private void checkVersion() throws IOException {
  Version loadedVersion = loadVersion();
  LOG.info("Loaded NM state version info " + loadedVersion);
  if (loadedVersion.equals(getCurrentVersion())) {
    return;
  }
  if (loadedVersion.isCompatibleTo(getCurrentVersion())) {
    LOG.info("Storing NM state version info " + getCurrentVersion());
    storeVersion();
  } else {
    throw new IOException(
      "Incompatible version for NM state: expecting NM state version " 
          + getCurrentVersion() + ", but loading version " + loadedVersion);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:NMLeveldbStateStoreService.java


示例2: checkVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
/**
 * 1) Versioning scheme: major.minor. For e.g. 1.0, 1.1, 1.2...1.25, 2.0 etc.
 * 2) Any incompatible change of state-store is a major upgrade, and any
 *    compatible change of state-store is a minor upgrade.
 * 3) If theres's no version, treat it as CURRENT_VERSION_INFO.
 * 4) Within a minor upgrade, say 1.1 to 1.2:
 *    overwrite the version info and proceed as normal.
 * 5) Within a major upgrade, say 1.2 to 2.0:
 *    throw exception and indicate user to use a separate upgrade tool to
 *    upgrade RM state.
 */
public void checkVersion() throws Exception {
  Version loadedVersion = loadVersion();
  LOG.info("Loaded RM state version info " + loadedVersion);
  if (loadedVersion != null && loadedVersion.equals(getCurrentVersion())) {
    return;
  }
  // if there is no version info, treat it as CURRENT_VERSION_INFO;
  if (loadedVersion == null) {
    loadedVersion = getCurrentVersion();
  }
  if (loadedVersion.isCompatibleTo(getCurrentVersion())) {
    LOG.info("Storing RM state version info " + getCurrentVersion());
    storeVersion();
  } else {
    throw new RMStateVersionIncompatibleException(
      "Expecting RM state version " + getCurrentVersion()
          + ", but loading version " + loadedVersion);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:RMStateStore.java


示例3: checkVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
/**
 * 1) Versioning timeline store: major.minor. For e.g. 1.0, 1.1, 1.2...1.25, 2.0 etc.
 * 2) Any incompatible change of TS-store is a major upgrade, and any
 *    compatible change of TS-store is a minor upgrade.
 * 3) Within a minor upgrade, say 1.1 to 1.2:
 *    overwrite the version info and proceed as normal.
 * 4) Within a major upgrade, say 1.2 to 2.0:
 *    throw exception and indicate user to use a separate upgrade tool to
 *    upgrade timeline store or remove incompatible old state.
 */
private void checkVersion() throws IOException {
  Version loadedVersion = loadVersion();
  LOG.info("Loaded timeline store version info " + loadedVersion);
  if (loadedVersion.equals(getCurrentVersion())) {
    return;
  }
  if (loadedVersion.isCompatibleTo(getCurrentVersion())) {
    LOG.info("Storing timeline store version info " + getCurrentVersion());
    dbStoreVersion(CURRENT_VERSION_INFO);
  } else {
    String incompatibleMessage = 
        "Incompatible version for timeline store: expecting version " 
            + getCurrentVersion() + ", but loading version " + loadedVersion;
    LOG.fatal(incompatibleMessage);
    throw new IOException(incompatibleMessage);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:LeveldbTimelineStore.java


示例4: loadVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
@VisibleForTesting
Version loadVersion() throws IOException {
  try {
    byte[] data = db.get(TIMELINE_STATE_STORE_VERSION_KEY);
    // if version is not stored previously, treat it as CURRENT_VERSION_INFO.
    if (data == null || data.length == 0) {
      return getCurrentVersion();
    }
    Version version =
        new VersionPBImpl(
            YarnServerCommonProtos.VersionProto.parseFrom(data));
    return version;
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:LeveldbTimelineStateStore.java


示例5: checkVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
/**
 * 1) Versioning timeline state store:
 * major.minor. For e.g. 1.0, 1.1, 1.2...1.25, 2.0 etc.
 * 2) Any incompatible change of TS-store is a major upgrade, and any
 * compatible change of TS-store is a minor upgrade.
 * 3) Within a minor upgrade, say 1.1 to 1.2:
 * overwrite the version info and proceed as normal.
 * 4) Within a major upgrade, say 1.2 to 2.0:
 * throw exception and indicate user to use a separate upgrade tool to
 * upgrade timeline store or remove incompatible old state.
 */
private void checkVersion() throws IOException {
  Version loadedVersion = loadVersion();
  LOG.info("Loaded timeline state store version info " + loadedVersion);
  if (loadedVersion.equals(getCurrentVersion())) {
    return;
  }
  if (loadedVersion.isCompatibleTo(getCurrentVersion())) {
    LOG.info("Storing timeline state store version info " + getCurrentVersion());
    storeVersion(CURRENT_VERSION_INFO);
  } else {
    String incompatibleMessage =
        "Incompatible version for timeline state store: expecting version "
            + getCurrentVersion() + ", but loading version " + loadedVersion;
    LOG.fatal(incompatibleMessage);
    throw new IOException(incompatibleMessage);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:LeveldbTimelineStateStore.java


示例6: checkVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
/**
 * 1) Versioning scheme: major.minor. For e.g. 1.0, 1.1, 1.2...1.25, 2.0 etc.
 * 2) Any incompatible change of DB schema is a major upgrade, and any
 *    compatible change of DB schema is a minor upgrade.
 * 3) Within a minor upgrade, say 1.1 to 1.2:
 *    overwrite the version info and proceed as normal.
 * 4) Within a major upgrade, say 1.2 to 2.0:
 *    throw exception and indicate user to use a separate upgrade tool to
 *    upgrade shuffle info or remove incompatible old state.
 */
private void checkVersion() throws IOException {
  Version loadedVersion = loadVersion();
  LOG.info("Loaded state DB schema version info " + loadedVersion);
  if (loadedVersion.equals(getCurrentVersion())) {
    return;
  }
  if (loadedVersion.isCompatibleTo(getCurrentVersion())) {
    LOG.info("Storing state DB schedma version info " + getCurrentVersion());
    storeVersion();
  } else {
    throw new IOException(
      "Incompatible version for state DB schema: expecting DB schema version " 
          + getCurrentVersion() + ", but loading version " + loadedVersion);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:ShuffleHandler.java


示例7: checkVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
/**
 * 1) Versioning scheme: major.minor. For e.g. 1.0, 1.1, 1.2...1.25, 2.0 etc.
 * 2) Any incompatible change of state-store is a major upgrade, and any
 *    compatible change of state-store is a minor upgrade.
 * 3) Within a minor upgrade, say 1.1 to 1.2:
 *    overwrite the version info and proceed as normal.
 * 4) Within a major upgrade, say 1.2 to 2.0:
 *    throw exception and indicate user to use a separate upgrade tool to
 *    upgrade state or remove incompatible old state.
 */
private void checkVersion() throws IOException {
  Version loadedVersion = loadVersion();
  LOG.info("Loaded state version info " + loadedVersion);
  if (loadedVersion.equals(getCurrentVersion())) {
    return;
  }
  if (loadedVersion.isCompatibleTo(getCurrentVersion())) {
    LOG.info("Storing state version info " + getCurrentVersion());
    storeVersion();
  } else {
    throw new IOException(
      "Incompatible version for state: expecting state version "
          + getCurrentVersion() + ", but loading version " + loadedVersion);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:HistoryServerLeveldbStateStoreService.java


示例8: checkVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
/**
 * 1) Versioning timeline store: major.minor. For e.g. 1.0, 1.1, 1.2...1.25,
 * 2.0 etc. 2) Any incompatible change of TS-store is a major upgrade, and any
 * compatible change of TS-store is a minor upgrade. 3) Within a minor
 * upgrade, say 1.1 to 1.2: overwrite the version info and proceed as normal.
 * 4) Within a major upgrade, say 1.2 to 2.0: throw exception and indicate
 * user to use a separate upgrade tool to upgrade timeline store or remove
 * incompatible old state.
 */
private void checkVersion() throws IOException {
  Version loadedVersion = loadVersion();
  LOG.info("Loaded timeline store version info " + loadedVersion);
  if (loadedVersion.equals(getCurrentVersion())) {
    return;
  }
  if (loadedVersion.isCompatibleTo(getCurrentVersion())) {
    LOG.info("Storing timeline store version info " + getCurrentVersion());
    dbStoreVersion(CURRENT_VERSION_INFO);
  } else {
    String incompatibleMessage = "Incompatible version for timeline store: "
        + "expecting version " + getCurrentVersion()
        + ", but loading version " + loadedVersion;
    LOG.fatal(incompatibleMessage);
    throw new IOException(incompatibleMessage);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:RollingLevelDBTimelineStore.java


示例9: loadVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
Version loadVersion() throws IOException {
  byte[] data = db.get(bytes(DB_SCHEMA_VERSION_KEY));
  // if version is not stored previously, treat it as CURRENT_VERSION_INFO.
  if (data == null || data.length == 0) {
    return getCurrentVersion();
  }
  Version version =
      new VersionPBImpl(VersionProto.parseFrom(data));
  return version;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:NMLeveldbStateStoreService.java


示例10: dbStoreVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
private void dbStoreVersion(Version state) throws IOException {
  String key = DB_SCHEMA_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:NMLeveldbStateStoreService.java


示例11: testCheckVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
@Test
public void testCheckVersion() throws IOException {
  // default version
  Version defaultVersion = stateStore.getCurrentVersion();
  Assert.assertEquals(defaultVersion, stateStore.loadVersion());

  // compatible version
  Version compatibleVersion =
      Version.newInstance(defaultVersion.getMajorVersion(),
        defaultVersion.getMinorVersion() + 2);
  stateStore.storeVersion(compatibleVersion);
  Assert.assertEquals(compatibleVersion, stateStore.loadVersion());
  restartStateStore();
  // overwrite the compatible version
  Assert.assertEquals(defaultVersion, stateStore.loadVersion());

  // incompatible version
  Version incompatibleVersion =
    Version.newInstance(defaultVersion.getMajorVersion() + 1,
        defaultVersion.getMinorVersion());
  stateStore.storeVersion(incompatibleVersion);
  try {
    restartStateStore();
    Assert.fail("Incompatible version, should expect fail here.");
  } catch (ServiceStateException e) {
    Assert.assertTrue("Exception message mismatch", 
      e.getMessage().contains("Incompatible version for NM state:"));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:TestNMLeveldbStateStoreService.java


示例12: dbStoreVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
void dbStoreVersion(Version state) throws IOException {
  String key = VERSION_NODE;
  byte[] data = ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:LeveldbRMStateStore.java


示例13: loadVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
@Override
protected synchronized Version loadVersion() throws Exception {
  String versionNodePath = getNodePath(zkRootNodePath, VERSION_NODE);

  if (existsWithRetries(versionNodePath, false) != null) {
    byte[] data = getDataWithRetries(versionNodePath, false);
    Version version =
        new VersionPBImpl(VersionProto.parseFrom(data));
    return version;
  }
  return null;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:ZKRMStateStore.java


示例14: loadVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
@Override
protected synchronized Version loadVersion() throws Exception {
  Path versionNodePath = getNodePath(rootDirPath, VERSION_NODE);
  FileStatus status = getFileStatusWithRetries(versionNodePath);
  if (status != null) {
    byte[] data = readFileWithRetries(versionNodePath, status.getLen());
    Version version =
        new VersionPBImpl(VersionProto.parseFrom(data));
    return version;
  }
  return null;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:FileSystemRMStateStore.java


示例15: testCheckVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
public void testCheckVersion(RMStateStoreHelper stateStoreHelper)
    throws Exception {
  RMStateStore store = stateStoreHelper.getRMStateStore();
  store.setRMDispatcher(new TestDispatcher());

  // default version
  Version defaultVersion = stateStoreHelper.getCurrentVersion();
  store.checkVersion();
  Assert.assertEquals(defaultVersion, store.loadVersion());

  // compatible version
  Version compatibleVersion =
      Version.newInstance(defaultVersion.getMajorVersion(),
        defaultVersion.getMinorVersion() + 2);
  stateStoreHelper.writeVersion(compatibleVersion);
  Assert.assertEquals(compatibleVersion, store.loadVersion());
  store.checkVersion();
  // overwrite the compatible version
  Assert.assertEquals(defaultVersion, store.loadVersion());

  // incompatible version
  Version incompatibleVersion =
      Version.newInstance(defaultVersion.getMajorVersion() + 2,
        defaultVersion.getMinorVersion());
  stateStoreHelper.writeVersion(incompatibleVersion);
  try {
    store.checkVersion();
    Assert.fail("Invalid version, should fail.");
  } catch (Throwable t) {
    Assert.assertTrue(t instanceof RMStateVersionIncompatibleException);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:RMStateStoreTestBase.java


示例16: loadVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
Version loadVersion() throws IOException {
  try {
    byte[] data = db.get(bytes(TIMELINE_STORE_VERSION_KEY));
    // if version is not stored previously, treat it as CURRENT_VERSION_INFO.
    if (data == null || data.length == 0) {
      return getCurrentVersion();
    }
    Version version =
        new VersionPBImpl(VersionProto.parseFrom(data));
    return version;
  } catch(DBException e) {
    throw new IOException(e);    	
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:LeveldbTimelineStore.java


示例17: dbStoreVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
private void dbStoreVersion(Version state) throws IOException {
  String key = TIMELINE_STORE_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:LeveldbTimelineStore.java


示例18: storeVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
@VisibleForTesting
void storeVersion(Version state) throws IOException {
  byte[] data =
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(TIMELINE_STATE_STORE_VERSION_KEY, data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:LeveldbTimelineStateStore.java


示例19: testCheckVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
@Test
public void testCheckVersion() throws IOException {
  LeveldbTimelineStateStore store =
      initAndStartTimelineServiceStateStoreService();
  // default version
  Version defaultVersion = store.getCurrentVersion();
  Assert.assertEquals(defaultVersion, store.loadVersion());

  // compatible version
  Version compatibleVersion =
      Version.newInstance(defaultVersion.getMajorVersion(),
          defaultVersion.getMinorVersion() + 2);
  store.storeVersion(compatibleVersion);
  Assert.assertEquals(compatibleVersion, store.loadVersion());
  store.stop();

  // overwrite the compatible version
  store = initAndStartTimelineServiceStateStoreService();
  Assert.assertEquals(defaultVersion, store.loadVersion());

  // incompatible version
  Version incompatibleVersion =
      Version.newInstance(defaultVersion.getMajorVersion() + 1,
          defaultVersion.getMinorVersion());
  store.storeVersion(incompatibleVersion);
  store.stop();

  try {
    initAndStartTimelineServiceStateStoreService();
    Assert.fail("Incompatible version, should expect fail here.");
  } catch (ServiceStateException e) {
    Assert.assertTrue("Exception message mismatch",
        e.getMessage().contains("Incompatible version for timeline state store"));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:TestLeveldbTimelineStateStore.java


示例20: loadVersion

import org.apache.hadoop.yarn.server.records.Version; //导入依赖的package包/类
@VisibleForTesting
Version loadVersion() throws IOException {
  byte[] data = stateDb.get(bytes(STATE_DB_SCHEMA_VERSION_KEY));
  // if version is not stored previously, treat it as CURRENT_VERSION_INFO.
  if (data == null || data.length == 0) {
    return getCurrentVersion();
  }
  Version version =
      new VersionPBImpl(VersionProto.parseFrom(data));
  return version;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:ShuffleHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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