Class CachingJavaSourceClassLoader

    • Constructor Detail

      • CachingJavaSourceClassLoader

        public CachingJavaSourceClassLoader​(ClassLoader parentClassLoader,
                                            ResourceFinder sourceFinder,
                                            String optionalCharacterEncoding,
                                            ResourceFinder classFileCacheResourceFinder,
                                            ResourceCreator classFileCacheResourceCreator)
        Notice that this class is thread-safe if and only if the classFileCacheResourceCreator stores its data atomically, i.e. the classFileCacheResourceFinder sees the resource written by the classFileCacheResourceCreator only after the OutputStream is closed.

        In order to make the caching scheme work, both the classFileCacheResourceFinder and the sourceFinder must support the Resource.lastModified() method, so that the modification time of the source and the class files can be compared.

        Parameters:
        parentClassLoader - Attempt to load classes through this one before looking for source files
        sourceFinder - Finds Java™ source for class pkg.Cls in resource pkg/Cls.java
        optionalCharacterEncoding - Encoding of Java™ source or null for platform default encoding
        classFileCacheResourceFinder - Finds precompiled class pkg.Cls in resource pkg/Cls.class (see class description)
        classFileCacheResourceCreator - Stores compiled class pkg.Cls in resource pkg/Cls.class (see class description)