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


Java AuxiliaryService.init方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.api.AuxiliaryService.init方法的典型用法代码示例。如果您正苦于以下问题:Java AuxiliaryService.init方法的具体用法?Java AuxiliaryService.init怎么用?Java AuxiliaryService.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.server.api.AuxiliaryService的用法示例。


在下文中一共展示了AuxiliaryService.init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serviceInit

import org.apache.hadoop.yarn.server.api.AuxiliaryService; //导入方法依赖的package包/类
@Override
public void serviceInit(Configuration conf) throws Exception {
  Collection<String> auxNames = conf.getStringCollection(
      YarnConfiguration.NM_AUX_SERVICES);
  for (final String sName : auxNames) {
    try {
      Class<? extends AuxiliaryService> sClass = conf.getClass(
            String.format(YarnConfiguration.NM_AUX_SERVICE_FMT, sName), null,
            AuxiliaryService.class);
      if (null == sClass) {
        throw new RuntimeException("No class defined for " + sName);
      }
      AuxiliaryService s = ReflectionUtils.newInstance(sClass, conf);
      // TODO better use s.getName()?
      if(!sName.equals(s.getName())) {
        LOG.warn("The Auxilurary Service named '"+sName+"' in the "
                +"configuration is for class "+sClass+" which has "
                +"a name of '"+s.getName()+"'. Because these are "
                +"not the same tools trying to send ServiceData and read "
                +"Service Meta Data may have issues unless the refer to "
                +"the name in the config.");
      }
      addService(sName, s);
      s.init(conf);
    } catch (RuntimeException e) {
      LOG.fatal("Failed to initialize " + sName, e);
      throw e;
    }
  }
  super.serviceInit(conf);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:32,代码来源:AuxServices.java

示例2: serviceInit

import org.apache.hadoop.yarn.server.api.AuxiliaryService; //导入方法依赖的package包/类
@Override
public void serviceInit(Configuration conf) throws Exception {
  Collection<String> auxNames = conf.getStringCollection(
      YarnConfiguration.NM_AUX_SERVICES);
  for (final String sName : auxNames) {
    try {
      Preconditions
          .checkArgument(
              validateAuxServiceName(sName),
              "The ServiceName: " + sName + " set in " +
              YarnConfiguration.NM_AUX_SERVICES +" is invalid." +
              "The valid service name should only contain a-zA-Z0-9_ " +
              "and can not start with numbers");
      Class<? extends AuxiliaryService> sClass = conf.getClass(
            String.format(YarnConfiguration.NM_AUX_SERVICE_FMT, sName), null,
            AuxiliaryService.class);
      if (null == sClass) {
        throw new RuntimeException("No class defined for " + sName);
      }
      AuxiliaryService s = ReflectionUtils.newInstance(sClass, conf);
      // TODO better use s.getName()?
      if(!sName.equals(s.getName())) {
        LOG.warn("The Auxilurary Service named '"+sName+"' in the "
                +"configuration is for class "+sClass+" which has "
                +"a name of '"+s.getName()+"'. Because these are "
                +"not the same tools trying to send ServiceData and read "
                +"Service Meta Data may have issues unless the refer to "
                +"the name in the config.");
      }
      addService(sName, s);
      s.init(conf);
    } catch (RuntimeException e) {
      LOG.fatal("Failed to initialize " + sName, e);
      throw e;
    }
  }
  super.serviceInit(conf);
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:39,代码来源:AuxServices.java

示例3: serviceInit

import org.apache.hadoop.yarn.server.api.AuxiliaryService; //导入方法依赖的package包/类
@Override
public void serviceInit(Configuration conf) throws Exception {
  final FsPermission storeDirPerms = new FsPermission((short)0700);
  Path stateStoreRoot = null;
  FileSystem stateStoreFs = null;
  boolean recoveryEnabled = conf.getBoolean(
      YarnConfiguration.NM_RECOVERY_ENABLED,
      YarnConfiguration.DEFAULT_NM_RECOVERY_ENABLED);
  if (recoveryEnabled) {
    stateStoreRoot = new Path(conf.get(YarnConfiguration.NM_RECOVERY_DIR),
        STATE_STORE_ROOT_NAME);
    stateStoreFs = FileSystem.getLocal(conf);
  }
  Collection<String> auxNames = conf.getStringCollection(
      YarnConfiguration.NM_AUX_SERVICES);
  for (final String sName : auxNames) {
    try {
      Preconditions
          .checkArgument(
              validateAuxServiceName(sName),
              "The ServiceName: " + sName + " set in " +
              YarnConfiguration.NM_AUX_SERVICES +" is invalid." +
              "The valid service name should only contain a-zA-Z0-9_ " +
              "and can not start with numbers");
      Class<? extends AuxiliaryService> sClass = conf.getClass(
            String.format(YarnConfiguration.NM_AUX_SERVICE_FMT, sName), null,
            AuxiliaryService.class);
      if (null == sClass) {
        throw new RuntimeException("No class defined for " + sName);
      }
      AuxiliaryService s = ReflectionUtils.newInstance(sClass, conf);
      // TODO better use s.getName()?
      if(!sName.equals(s.getName())) {
        LOG.warn("The Auxilurary Service named '"+sName+"' in the "
                +"configuration is for "+sClass+" which has "
                +"a name of '"+s.getName()+"'. Because these are "
                +"not the same tools trying to send ServiceData and read "
                +"Service Meta Data may have issues unless the refer to "
                +"the name in the config.");
      }
      addService(sName, s);
      if (recoveryEnabled) {
        Path storePath = new Path(stateStoreRoot, sName);
        stateStoreFs.mkdirs(storePath, storeDirPerms);
        s.setRecoveryPath(storePath);
      }
      s.init(conf);
    } catch (RuntimeException e) {
      LOG.fatal("Failed to initialize " + sName, e);
      throw e;
    }
  }
  super.serviceInit(conf);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:55,代码来源:AuxServices.java

示例4: serviceInit

import org.apache.hadoop.yarn.server.api.AuxiliaryService; //导入方法依赖的package包/类
@Override
public void serviceInit(Configuration conf) throws Exception {
  final FsPermission storeDirPerms = new FsPermission((short)0700);
  Path stateStoreRoot = null;
  FileSystem stateStoreFs = null;
  boolean recoveryEnabled = conf.getBoolean(
      YarnConfiguration.NM_RECOVERY_ENABLED,
      YarnConfiguration.DEFAULT_NM_RECOVERY_ENABLED);
  if (recoveryEnabled) {
    stateStoreRoot = new Path(conf.get(YarnConfiguration.NM_RECOVERY_DIR),
        STATE_STORE_ROOT_NAME);
    stateStoreFs = FileSystem.getLocal(conf);
  }
  Collection<String> auxNames = conf.getStringCollection(
      YarnConfiguration.NM_AUX_SERVICES);
  for (final String sName : auxNames) {
    try {
      Preconditions
          .checkArgument(
              validateAuxServiceName(sName),
              "The ServiceName: " + sName + " set in " +
              YarnConfiguration.NM_AUX_SERVICES +" is invalid." +
              "The valid service name should only contain a-zA-Z0-9_ " +
              "and can not start with numbers");
      Class<? extends AuxiliaryService> sClass = conf.getClass(
            String.format(YarnConfiguration.NM_AUX_SERVICE_FMT, sName), null,
            AuxiliaryService.class);
      if (null == sClass) {
        throw new RuntimeException("No class defined for " + sName);
      }
      AuxiliaryService s = ReflectionUtils.newInstance(sClass, conf);
      // TODO better use s.getName()?
      if(!sName.equals(s.getName())) {
        LOG.warn("The Auxilurary Service named '"+sName+"' in the "
                +"configuration is for class "+sClass+" which has "
                +"a name of '"+s.getName()+"'. Because these are "
                +"not the same tools trying to send ServiceData and read "
                +"Service Meta Data may have issues unless the refer to "
                +"the name in the config.");
      }
      addService(sName, s);
      if (recoveryEnabled) {
        Path storePath = new Path(stateStoreRoot, sName);
        stateStoreFs.mkdirs(storePath, storeDirPerms);
        s.setRecoveryPath(storePath);
      }
      s.init(conf);
    } catch (RuntimeException e) {
      LOG.fatal("Failed to initialize " + sName, e);
      throw e;
    }
  }
  super.serviceInit(conf);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:55,代码来源:AuxServices.java


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