Exemplo n.º 1
0
 static boolean unregisterJar(List<String> jarsToUnregister) {
   LogHelper console = getConsole();
   try {
     Utilities.removeFromClassPath(jarsToUnregister.toArray(new String[0]));
     console.printInfo("Deleted " + jarsToUnregister + " from class path");
     return true;
   } catch (Exception e) {
     console.printError(
         "Unable to unregister " + jarsToUnregister + "\nException: " + e.getMessage(),
         "\n" + org.apache.hadoop.util.StringUtils.stringifyException(e));
     return false;
   }
 }
Exemplo n.º 2
0
 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);
   }
 }