ClassLoader utilities
The library contains classes which provide easier implementation of ClassLoaders
. Our goal was to separate the mechanism of retrieving the data used by the a class loader and the ClassLoader
implementation itself. This can result in a pluggable way of creating class loaders where the locating of resources are done by separate implementations.
The ClassLoaderDataFinder
interface is used to define the behaviour of how the resources should be located. It doesn't specify any restrictions on them. Important to note is that this interface extends Closeable
, so that the owner of the objects need to close the instances. This is important to avoid memory leaks when a class loader is backed by JARs or other managed resources.
The interface is also RMI compatible, meaning that the class data can be provided over the network. This can be especially useful if two Java processes need to communicate and cooperate when execution an operation. (E.g. loading Java classes that need to be tested.)
A ClassLoader
can be constructed using the MultiDataClassLoader
class.