Class ModuleClassLoader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    final class ModuleClassLoader
    extends ClassLoaderProxy
    ClassLoader that loads classes for a module.
    • Constructor Summary

      Constructors 
      Constructor Description
      ModuleClassLoader​(ModuleImpl owner, java.net.URL[] shared, java.lang.ClassLoader parent)
      Creates a new instance of ClassLoader
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void dumpState​(java.io.PrintStream writer)  
      protected void finalize()  
      protected java.lang.Class<?> findClass​(java.lang.String name)  
      ModuleImpl getOwner()  
      java.net.URL getResource​(java.lang.String name)  
      java.util.Enumeration<java.net.URL> getResources​(java.lang.String name)  
      private void initialize​(java.lang.String name)
      Lazily initialize this module if not done so yet.
      protected java.lang.Class<?> loadClass​(java.lang.String name, boolean resolve)  
      void stop()
      called by the facade class loader when it is garbage collected.
      java.lang.String toString()  
      • Methods inherited from class java.net.URLClassLoader

        close, definePackage, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
      • Methods inherited from class java.security.SecureClassLoader

        defineClass, defineClass
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • initialized

        private volatile boolean initialized
        Module will be initialized when this classloader is consulted for the first time.
      • initializerThread

        private java.lang.StackTraceElement[] initializerThread
      • initializerClassName

        private java.lang.String initializerClassName
      • META_INF_SERVICES

        private static final java.lang.String META_INF_SERVICES
        See Also:
        Constant Field Values
    • Constructor Detail

      • ModuleClassLoader

        public ModuleClassLoader​(ModuleImpl owner,
                                 java.net.URL[] shared,
                                 java.lang.ClassLoader parent)
        Creates a new instance of ClassLoader
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class ClassLoaderProxy
        Throws:
        java.lang.Throwable
      • loadClass

        protected java.lang.Class<?> loadClass​(java.lang.String name,
                                               boolean resolve)
                                        throws java.lang.ClassNotFoundException
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • findClass

        protected java.lang.Class<?> findClass​(java.lang.String name)
                                        throws java.lang.ClassNotFoundException
        Overrides:
        findClass in class ClassLoaderProxy
        Throws:
        java.lang.ClassNotFoundException
      • getResource

        public java.net.URL getResource​(java.lang.String name)
        Overrides:
        getResource in class java.lang.ClassLoader
      • getResources

        public java.util.Enumeration<java.net.URL> getResources​(java.lang.String name)
                                                         throws java.io.IOException
        Overrides:
        getResources in class java.lang.ClassLoader
        Throws:
        java.io.IOException
      • initialize

        private void initialize​(java.lang.String name)
        Lazily initialize this module if not done so yet.
      • dumpState

        void dumpState​(java.io.PrintStream writer)
      • stop

        public void stop()
        called by the facade class loader when it is garbage collected. this is a good time to see if this module should be unloaded.
        Overrides:
        stop in class ClassLoaderProxy