public class ContainerSweepClassLoader extends BundleDelegatingClassLoader
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.
bundle, clsLdr
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. |
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. |
classNotFoundException, findClass, findResource, findResources, getBundle, toString
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
public ContainerSweepClassLoader(org.osgi.framework.Bundle bundle)
Bundle
only.bundle
- The bundle.public ContainerSweepClassLoader(org.osgi.framework.Bundle bundle, ClassLoader classLoader)
Bundle
and another ClassLoader
to check.bundle
- The bundle.classLoader
- The other classloader to check.protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
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.loadClass
in class BundleDelegatingClassLoader
name
- The classname.resolve
- Whether to resolve the class or not.ClassNotFoundException
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019