Package co.cask.cdap.common.lang.jar

Examples of co.cask.cdap.common.lang.jar.ProgramClassLoader


                                                         ClassLoader parentClassLoader) throws IOException {
    // TODO: Unify the creation of FilterClassLoader, see CDAP-6
    Predicate<String> predicate = Predicates.in(Sets.newHashSet(apiResourceList));
    ClassLoader filterParent = Objects.firstNonNull(Thread.currentThread().getContextClassLoader(),
                                                    ClassLoaders.class.getClassLoader());
    return new ProgramClassLoader(unpackedJarDir, new CombineClassLoader(new FilterClassLoader(predicate, filterParent),
                                                                         ImmutableList.of(parentClassLoader)));
  }
View Full Code Here


    // deploy dataset modules
    ApplicationSpecification specification = input.getSpecification();
    File unpackedLocation = Files.createTempDir();
    try {
      BundleJarUtil.unpackProgramJar(input.getArchive(), unpackedLocation);
      ProgramClassLoader classLoader = ClassLoaders.newProgramClassLoader(unpackedLocation,
                                                                          ApiResourceListHolder.getResourceList(),
                                                                          this.getClass().getClassLoader());
      for (Map.Entry<String, String> moduleEntry : specification.getDatasetModules().entrySet()) {
        // note: using app class loader to load module class
        @SuppressWarnings("unchecked")
        Class<?> clazz = classLoader.loadClass(moduleEntry.getValue());
        String moduleName = moduleEntry.getKey();
        try {
          // note: we can deploy module or create module from Dataset class
          // note: it seems dangerous to instantiate dataset module here, but this will be fine when we move deploy into
          //       isolated user's environment (e.g. separate yarn container)
View Full Code Here

    this.appFabricClient = new AppFabricClient(httpHandler, serviceHttpHandler, locationFactory);

    try {
      File tempDir = tempFolder.newFolder();
      BundleJarUtil.unpackProgramJar(deployedJar, tempDir);
      ProgramClassLoader classLoader = ClassLoaders.newProgramClassLoader
        (tempDir, ApiResourceListHolder.getResourceList(), this.getClass().getClassLoader());
      this.dataSetInstantiator = new DataSetInstantiator(datasetFramework, configuration,
                                                         new DataSetClassLoader(classLoader),
                                                         // todo: collect metrics for datasets outside programs too
                                                         null, null);
View Full Code Here

TOP

Related Classes of co.cask.cdap.common.lang.jar.ProgramClassLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.