org.apache.ignite.osgi.classloaders

## Class ContainerSweepClassLoader

- java.lang.Object
- - java.lang.ClassLoader
  - - org.apache.ignite.osgi.classloaders.BundleDelegatingClassLoader
    - - org.apache.ignite.osgi.classloaders.ContainerSweepClassLoader

-     public class ContainerSweepClassLoader
      extends BundleDelegatingClassLoader

  A `ClassLoader` implementation that first attempts to load the class from the associated `Bundle`. As a fallback, it sweeps the entire OSGi container to find the requested class, returning the first hit.

  It keeps a cache of resolved classes and unresolvable classes, in order to optimize subsequent lookups.

- - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.osgi.classloaders.BundleDelegatingClassLoader

      `bundle, clsLdr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContainerSweepClassLoader(org.osgi.framework.Bundle bundle)` Constructor with a `Bundle` only.
    `ContainerSweepClassLoader(org.osgi.framework.Bundle bundle, ClassLoader classLoader)` Constructor with a `Bundle` and another `ClassLoader` to check.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Class<?>` | `loadClass(String name, boolean resolve)` Runs the same logic to find the class as `BundleDelegatingClassLoader`, but if not found, sweeps the OSGi container to locate the first `Bundle` that can load the class, and uses it to do so.
    `protected Class<?>` | `sweepContainer(String name)` Sweeps the OSGi container to find the first `Bundle` that can load the class.

    - ### Methods inherited from class org.apache.ignite.osgi.classloaders.BundleDelegatingClassLoader

      `classNotFoundException, findClass, findResource, findResources, getBundle, toString`

    - ### Methods inherited from class java.lang.ClassLoader

      `clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ContainerSweepClassLoader

          public ContainerSweepClassLoader(org.osgi.framework.Bundle bundle)

      Constructor with a `Bundle` only.
      Parameters:
        `bundle` - The bundle.

    - #### ContainerSweepClassLoader

          public ContainerSweepClassLoader(org.osgi.framework.Bundle bundle,
                                           ClassLoader classLoader)

      Constructor with a `Bundle` and another `ClassLoader` to check.
      Parameters:
        `bundle` - The bundle.
        `classLoader` - The other classloader to check.

  - ### Method Detail

    - #### loadClass

          protected Class<?> loadClass(String name,
                                       boolean resolve)
                                throws ClassNotFoundException

      Runs the same logic to find the class as `BundleDelegatingClassLoader`, but if not found, sweeps the OSGi container to locate the first `Bundle` that can load the class, and uses it to do so.
      Overrides:
        `loadClass` in class `BundleDelegatingClassLoader`
      Parameters:
        `name` - The classname.
        `resolve` - Whether to resolve the class or not.
      Returns:
        The loaded class.
      Throws:
        `ClassNotFoundException`

    - #### sweepContainer

          protected Class<?> sweepContainer(String name)

      Sweeps the OSGi container to find the first `Bundle` that can load the class.
      Parameters:
        `name` - The classname.
      Returns:
        The loaded class.

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020