org.apache.hadoop.hive.ql.exec.Utilities.addToClassPath()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(215)

本文整理了Java中org.apache.hadoop.hive.ql.exec.Utilities.addToClassPath()方法的一些代码示例,展示了Utilities.addToClassPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.addToClassPath()方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.exec.Utilities
类名称:Utilities
方法名:addToClassPath

Utilities.addToClassPath介绍

[英]Add new elements to the classpath.
[中]向类路径添加新元素。

代码示例

代码示例来源:origin: apache/hive

static void registerJars(List<String> newJars) throws IllegalArgumentException {
 LogHelper console = getConsole();
 try {
  ClassLoader loader = Thread.currentThread().getContextClassLoader();
  ClassLoader newLoader = Utilities.addToClassPath(loader, newJars.toArray(new String[0]));
  Thread.currentThread().setContextClassLoader(newLoader);
  SessionState.get().getConf().setClassLoader(newLoader);
  console.printInfo("Added " + newJars + " to class path");
 } catch (Exception e) {
  String message = "Unable to register " + newJars;
  throw new IllegalArgumentException(message, e);
 }
}

代码示例来源:origin: apache/hive

ClassLoader updatedCl = null;
try {
 updatedCl = Utilities.addToClassPath(executorClassloader, jars);
 if (LOG.isInfoEnabled()) {
  LOG.info("Added " + jars.length + " jars to classpath");

代码示例来源:origin: apache/drill

static void registerJars(List<String> newJars) throws IllegalArgumentException {
 LogHelper console = getConsole();
 try {
  ClassLoader loader = Thread.currentThread().getContextClassLoader();
  ClassLoader newLoader = Utilities.addToClassPath(loader, newJars.toArray(new String[0]));
  Thread.currentThread().setContextClassLoader(newLoader);
  SessionState.get().getConf().setClassLoader(newLoader);
  console.printInfo("Added " + newJars + " to class path");
 } catch (Exception e) {
  String message = "Unable to register " + newJars;
  throw new IllegalArgumentException(message, e);
 }
}

代码示例来源:origin: apache/hive

/**
 * Load the jars under the path specified in hive.aux.jars.path property. Add
 * the jars to the classpath so the local task can refer to them.
 * @throws IOException
 */
public void loadAuxJars() throws IOException {
 String[] jarPaths = StringUtils.split(sessionConf.getAuxJars(), ',');
 if (ArrayUtils.isEmpty(jarPaths)) {
  return;
 }
 URLClassLoader currentCLoader =
   (URLClassLoader) SessionState.get().getConf().getClassLoader();
 currentCLoader =
   (URLClassLoader) Utilities.addToClassPath(currentCLoader, jarPaths);
 sessionConf.setClassLoader(currentCLoader);
 Thread.currentThread().setContextClassLoader(currentCLoader);
}

代码示例来源:origin: apache/drill

/**
 * Load the jars under the path specified in hive.aux.jars.path property. Add
 * the jars to the classpath so the local task can refer to them.
 * @throws IOException
 */
public void loadAuxJars() throws IOException {
 String[] jarPaths = StringUtils.split(sessionConf.getAuxJars(), ',');
 if (ArrayUtils.isEmpty(jarPaths)) return;
 URLClassLoader currentCLoader =
   (URLClassLoader) SessionState.get().getConf().getClassLoader();
 currentCLoader =
   (URLClassLoader) Utilities.addToClassPath(currentCLoader, jarPaths);
 sessionConf.setClassLoader(currentCLoader);
 Thread.currentThread().setContextClassLoader(currentCLoader);
}

代码示例来源:origin: apache/hive

(URLClassLoader) SessionState.get().getConf().getClassLoader();
currentCLoader =
  (URLClassLoader) Utilities.addToClassPath(currentCLoader,
    reloadedAuxJars.toArray(new String[0]));
sessionConf.setClassLoader(currentCLoader);

代码示例来源:origin: apache/drill

(URLClassLoader) SessionState.get().getConf().getClassLoader();
currentCLoader =
  (URLClassLoader) Utilities.addToClassPath(currentCLoader,
    reloadedAuxJars.toArray(new String[0]));
sessionConf.setClassLoader(currentCLoader);

代码示例来源:origin: apache/hive

if (StringUtils.isNotEmpty(addedJars)) {
 ClassLoader loader = Thread.currentThread().getContextClassLoader();
 ClassLoader newLoader = addToClassPath(loader, addedJars.split(";"));
 Thread.currentThread().setContextClassLoader(newLoader);
 kryo.setClassLoader(newLoader);

代码示例来源:origin: apache/drill

if (addedJars != null && !addedJars.isEmpty()) {
 ClassLoader loader = Thread.currentThread().getContextClassLoader();
 ClassLoader newLoader = addToClassPath(loader, addedJars.split(";"));
 Thread.currentThread().setContextClassLoader(newLoader);
 kryo.setClassLoader(newLoader);

代码示例来源:origin: apache/hive

loader = Utilities.addToClassPath(loader, StringUtils.split(libjars, ","));

代码示例来源:origin: apache/drill

loader = Utilities.addToClassPath(loader, StringUtils.split(libjars, ","));

代码示例来源:origin: org.apache.hadoop.hive/hive-exec

public static boolean registerJar(String newJar) {
 LogHelper console = getConsole();
 try {
  ClassLoader loader = Thread.currentThread().getContextClassLoader();
  Thread.currentThread().setContextClassLoader(
    Utilities.addToClassPath(loader, StringUtils.split(newJar, ",")));
  console.printInfo("Added " + newJar + " to class path");
  return true;
 } catch (Exception e) {
  console.printError("Unable to register " + newJar + "\nException: "
    + e.getMessage(), "\n"
    + org.apache.hadoop.util.StringUtils.stringifyException(e));
  return false;
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

static void registerJars(List<String> newJars) throws IllegalArgumentException {
 LogHelper console = getConsole();
 try {
  ClassLoader loader = Thread.currentThread().getContextClassLoader();
  ClassLoader newLoader = Utilities.addToClassPath(loader, newJars.toArray(new String[0]));
  Thread.currentThread().setContextClassLoader(newLoader);
  SessionState.get().getConf().setClassLoader(newLoader);
  console.printInfo("Added " + newJars + " to class path");
 } catch (Exception e) {
  String message = "Unable to register " + newJars;
  throw new IllegalArgumentException(message, e);
 }
}

代码示例来源:origin: org.apache.hive/hive-llap-server

ClassLoader updatedCl = null;
try {
 updatedCl = Utilities.addToClassPath(executorClassloader, jars);
 if (LOG.isInfoEnabled()) {
  LOG.info("Added " + jars.length + " jars to classpath");

代码示例来源:origin: com.facebook.presto.hive/hive-apache

(URLClassLoader) SessionState.get().getConf().getClassLoader();
currentCLoader =
  (URLClassLoader) Utilities.addToClassPath(currentCLoader,
    reloadedAuxJars.toArray(new String[0]));
conf.setClassLoader(currentCLoader);

代码示例来源:origin: com.facebook.presto.hive/hive-apache

if (addedJars != null && !addedJars.isEmpty()) {
 ClassLoader loader = Thread.currentThread().getContextClassLoader();
 ClassLoader newLoader = addToClassPath(loader, addedJars.split(";"));
 Thread.currentThread().setContextClassLoader(newLoader);

代码示例来源:origin: org.apache.hadoop.hive/hive-exec

loader = Utilities.addToClassPath(loader, StringUtils.split(auxJars, ","));
loader = Utilities.addToClassPath(loader, StringUtils.split(addedJars, ","));

代码示例来源:origin: com.facebook.presto.hive/hive-apache

loader = Utilities.addToClassPath(loader, StringUtils.split(auxJars, ","));
loader = Utilities.addToClassPath(loader, StringUtils.split(addedJars, ","));

代码示例来源:origin: edu.berkeley.cs.shark/hive-cli

String auxJars = HiveConf.getVar(conf, HiveConf.ConfVars.HIVEAUXJARS);
if (StringUtils.isNotBlank(auxJars)) {
 loader = Utilities.addToClassPath(loader, StringUtils.split(auxJars, ","));

相关文章

Utilities类方法