"from -libjars command line option"); URL[] libjars = getLibJars(conf); if(libjars!=null && libjars.length>0) { conf.setClassLoader(new URLClassLoader(libjars, conf.getClassLoader()));
public void libjars(Configuration conf, Class<?>... targetClasses) throws IOException { String libjarsList = createLibJarList(targetClasses); conf.set("tmpjars", validateFiles(libjarsList, conf), "from -libjars command line option"); // setting libjars in client classpath URL[] libjars = GenericOptionsParser.getLibJars(conf); if (libjars != null && libjars.length > 0) { AccessController.doPrivileged(new PriviledgedClassLoader(conf, libjars)); } }
public void libjars(Configuration conf, Class<?>... targetClasses) throws IOException { String libjarsList = createLibJarList(targetClasses); conf.set("tmpjars", validateFiles(libjarsList, conf), "from -libjars command line option"); // setting libjars in client classpath URL[] libjars = GenericOptionsParser.getLibJars(conf); if (libjars != null && libjars.length > 0) { AccessController.doPrivileged(new PriviledgedClassLoader(conf, libjars)); } }
URL[] libJars = GenericOptionsParser.getLibJars(conf); if(libJars!=null) { for(URL url : libJars){
validateFiles(line.getOptionValue("libjars"), conf)); URL[] libjars = getLibJars(conf); if(libjars!=null && libjars.length>0) { conf.setClassLoader(new URLClassLoader(libjars, conf.getClassLoader()));
validateFiles(line.getOptionValue("libjars"), conf)); ClassLoader loader = new URLClassLoader(getLibJars(conf), conf.getClassLoader()); Thread.currentThread().setContextClassLoader(loader);
"from -libjars command line option"); URL[] libjars = getLibJars(conf); if(libjars!=null && libjars.length>0) { conf.setClassLoader(new URLClassLoader(libjars, conf.getClassLoader()));
"from -libjars command line option"); URL[] libjars = getLibJars(conf); if(libjars!=null && libjars.length>0) { conf.setClassLoader(new URLClassLoader(libjars, conf.getClassLoader()));
"from -libjars command line option"); URL[] libjars = getLibJars(conf); if(libjars!=null && libjars.length>0) { conf.setClassLoader(new URLClassLoader(libjars, conf.getClassLoader()));
"from -libjars command line option"); URL[] libjars = getLibJars(conf); if(libjars!=null && libjars.length>0) { conf.setClassLoader(new URLClassLoader(libjars, conf.getClassLoader()));
/** * w/ libjars with disabled cache. * @throws Exception if failed */ @Test public void w_libjars_disabled() throws Exception { File cacheRepo = folder.newFolder(); conf.set(LauncherOptionsParser.KEY_CACHE_REPOSITORY, cacheRepo.toURI().toString()); conf.setBoolean(LauncherOptionsParser.KEY_CACHE_ENABLED, false); File lib = putFile("dummy.jar"); LauncherOptions options = parse(new String[] { MockTool.class.getName(), LauncherOptionsParser.KEY_ARG_LIBRARIES, lib.getPath(), }); assertClasspath(options.getApplicationClassLoader().getURLs(), "testing"); assertThat(lib, is(inClasspath(options.getApplicationClassLoader().getURLs()))); assertClasspath(GenericOptionsParser.getLibJars(conf), "testing"); assertThat(lib, is(inClasspath(GenericOptionsParser.getLibJars(conf)))); }
/** * w/ libjars. * @throws Exception if failed */ @Test public void w_libjars_w_cache() throws Exception { File cacheRepo = folder.newFolder(); conf.set(LauncherOptionsParser.KEY_CACHE_REPOSITORY, cacheRepo.toURI().toString()); File lib = putFile("dummy.jar"); LauncherOptions options = parse(new String[] { MockTool.class.getName(), LauncherOptionsParser.KEY_ARG_LIBRARIES, lib.getPath(), }); assertClasspath(options.getApplicationClassLoader().getURLs(), "testing"); assertThat(lib, is(inClasspath(options.getApplicationClassLoader().getURLs()))); assertClasspath(GenericOptionsParser.getLibJars(conf), "testing"); assertThat(lib, is(not(inClasspath(GenericOptionsParser.getLibJars(conf))))); }
/** * w/ libjars. * @throws Exception if failed */ @Test public void w_libjars() throws Exception { File lib = putFile("dummy.jar"); LauncherOptions options = parse(new String[] { MockTool.class.getName(), LauncherOptionsParser.KEY_ARG_LIBRARIES, lib.getPath(), }); assertClasspath(options.getApplicationClassLoader().getURLs(), "testing"); assertThat(lib, is(inClasspath(options.getApplicationClassLoader().getURLs()))); assertClasspath(GenericOptionsParser.getLibJars(conf), "testing"); assertThat(lib, is(inClasspath(GenericOptionsParser.getLibJars(conf)))); JobConf jc = new JobConf(conf); assertThat(jc.getJar(), is(nullValue())); }