tree: 908e7578568175c0ff3afe1f229682567841f352 [path history] [tgz]
  1. .gitignore
  2. LICENSE
  3. README.md
  4. WIP.txt
  5. license-header.txt
  6. pom.xml
  7. src/
modules/vfs-class-loader/README.md

VFS Reloading ClassLoader

This module contains a ClassLoader implementation that can be used as the System ClassLoader.

Configuration

To use this ClassLoader as the System ClassLoader you must set the JVM system property java.system.class.loader to the fully qualified class name (org.apache.accumulo.classloader.vfs.ReloadingVFSClassLoader). This jar and it's dependent jars must be on the java.class.path.

To set the classpath for this ClassLoader you must define the system property vfs.class.loader.classpath and set it to locations that are supported by Apache Commons VFS.

The ClassLoader monitors the classpath for changes at 5 minute intervals. To change this interval define the sytem property vfs.classpath.monitor.seconds.

This ClassLoader follows the normal parent delegation model but can be set to load classes and resources first, before checking if the parent classloader can, by setting the system property vfs.class.loader.delegation to “post”.

Finally, this ClassLoader keeps a local cache of objects pulled from remote systems (via http, etc.). The default location for this cache directory is the value of the system property java.io.tmpdir. To change this location set the system property vfs.cache.dir to an existing directory.

Implementation

This ClassLoader maintains a VFSClassLoader delegate that references the classpath (as specified by vfs.class.loader.classpath). The ReloadingVFSClassLoader implements FileListener and creates a DefaultFileMonitor that checks for changes on the classpath at the interval specified by vfs.classpath.monitor.seconds and creates a new VFSClassLoader delegate. Future requests to load classes and resources will use this new delegate; the old delegate is no longer referenced (except by the classes it has loaded) and can be garbage collected.