Class ChildFirstPatternClassLoader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    @Deprecated
    public class ChildFirstPatternClassLoader
    extends URLClassLoader
    This is a URLClassLoader that behaves like a normal class loader except that it loads some classes always by itself, even if the parent class loader would also have been available to load them.

    Normal class loaders follow the parent-first strategy, so they never load classes which their parent could also load. This class loader follows the child-first strategy for a specific set of classes (given by a pattern) and the parent-first strategy for the rest.

    This class loader can be used if you want to load a component with its own class loader (so that it can be garbage collected independently, for example), but the parent class loader also sees the classes.

    • Constructor Detail

      • ChildFirstPatternClassLoader

        public ChildFirstPatternClassLoader​(Predicate<String> pLoadInChild,
                                            URL[] pUrls,
                                            ClassLoader pParent)
        Deprecated.
        Create a new class loader.
        Parameters:
        pLoadInChild - The predicate telling which classes should never be loaded by the parent.
        pUrls - The sources where this class loader should load classes from.
        pParent - The parent class loader.
      • ChildFirstPatternClassLoader

        public ChildFirstPatternClassLoader​(Pattern pClassPattern,
                                            URL[] pUrls,
                                            ClassLoader pParent)
        Deprecated.
        Create a new class loader.
        Parameters:
        pClassPattern - The pattern telling which classes should never be loaded by the parent.
        pUrls - The sources where this class loader should load classes from.
        pParent - The parent class loader.