當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.getClasses方法代碼示例

本文整理匯總了Java中org.apache.hadoop.conf.Configuration.getClasses方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getClasses方法的具體用法?Java Configuration.getClasses怎麽用?Java Configuration.getClasses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.conf.Configuration的用法示例。


在下文中一共展示了Configuration.getClasses方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFilterInitializers

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
/** Get an array of FilterConfiguration specified in the conf */
private static FilterInitializer[] getFilterInitializers(Configuration conf) {
  if (conf == null) {
    return null;
  }

  Class<?>[] classes = conf.getClasses(FILTER_INITIALIZER_PROPERTY);
  if (classes == null) {
    return null;
  }

  FilterInitializer[] initializers = new FilterInitializer[classes.length];
  for(int i = 0; i < classes.length; i++) {
    initializers[i] = (FilterInitializer)ReflectionUtils.newInstance(
        classes[i], conf);
  }
  return initializers;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:19,代碼來源:HttpServer2.java

示例2: getFilterInitializers

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
/** Get an array of FilterConfiguration specified in the conf */
private static FilterInitializer[] getFilterInitializers(Configuration conf) {
  if (conf == null) {
    return null;
  }

  Class<?>[] classes = conf.getClasses(FILTER_INITIALIZERS_PROPERTY);
  if (classes == null) {
    return null;
  }

  FilterInitializer[] initializers = new FilterInitializer[classes.length];
  for(int i = 0; i < classes.length; i++) {
    initializers[i] = (FilterInitializer)ReflectionUtils.newInstance(classes[i]);
  }
  return initializers;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:18,代碼來源:HttpServer.java

示例3: getInstances

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
/**
 * Get the value of the <code>name</code> property as a <code>List</code>
 * of objects implementing the interface specified by <code>xface</code>.
 *
 * An exception is thrown if any of the classes does not exist, or if it does
 * not implement the named interface.
 *
 * @param name the property name.
 * @param xface the interface implemented by the classes named by
 *        <code>name</code>.
 * @return a <code>List</code> of objects implementing <code>xface</code>.
 */
@SuppressWarnings("unchecked")
public static <U> List<U> getInstances(Configuration conf,
                                            String name, Class<U> xface) {
  List<U> ret = new ArrayList<U>();
  Class<?>[] classes = conf.getClasses(name);
  for (Class<?> cl: classes) {
    if (!xface.isAssignableFrom(cl)) {
      throw new RuntimeException(cl + " does not implement " + xface);
    }
    ret.add((U) ReflectionUtils.newInstance(cl, conf));
  }
  return ret;
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:26,代碼來源:ConfigurationHelper.java

示例4: configure

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
/**
 * Configure the {@link ResourceUsageMatcher} to load the configured plugins
 * and initialize them.
 */
@SuppressWarnings("unchecked")
public void configure(Configuration conf, ResourceCalculatorPlugin monitor, 
                      ResourceUsageMetrics metrics, Progressive progress) {
  Class[] plugins = conf.getClasses(RESOURCE_USAGE_EMULATION_PLUGINS);
  if (plugins == null) {
    System.out.println("No resource usage emulator plugins configured.");
  } else {
    for (Class clazz : plugins) {
      if (clazz != null) {
        if (ResourceUsageEmulatorPlugin.class.isAssignableFrom(clazz)) {
          ResourceUsageEmulatorPlugin plugin = 
            (ResourceUsageEmulatorPlugin) ReflectionUtils.newInstance(clazz, 
                                                                      conf);
          emulationPlugins.add(plugin);
        } else {
          throw new RuntimeException("Misconfigured resource usage plugins. " 
              + "Class " + clazz.getClass().getName() + " is not a resource "
              + "usage plugin as it does not extend "
              + ResourceUsageEmulatorPlugin.class.getName());
        }
      }
    }
  }

  // initialize the emulators once all the configured emulator plugins are
  // loaded
  for (ResourceUsageEmulatorPlugin emulator : emulationPlugins) {
    emulator.initialize(conf, metrics, monitor, progress);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:35,代碼來源:ResourceUsageMatcher.java


注:本文中的org.apache.hadoop.conf.Configuration.getClasses方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。