Javadoc
Return the origin class loader for the pathURLs
or null if the origin loader was
not present in the delegation hierarchy.
Preferred classes introduces the "class boomerang" problem to RMI class loading. A class
boomerang occurs when a class which is marked preferred is accessible from the codebase of a
virtual machine (VM) and is loaded by that VM. Since the VM has a copy of the class in its
own resources and the class is "returning to its origin" the class should not be preferred.
If the class is preferred, it will be loaded in a class loader for the local codebase
annotation. As a result, the class' type will not be compatible with types defined from the
local definition of the class file in the relevant VM.
A boomerang can also occur when a new child loader for a URL path is created but an ancestor
of the new class loader has the same URL path as the new class loader. In such cases the new
class loader should not be created. The incoming class should be loaded from the origin
ancestor instead.
A simple example of a class boomerang occurs when when a VM makes a remote method call to
itself. Suppose an object whose class was loaded locally in that VM and is preferred in the
codebase of the VM is passed in the call. When the VM receives its own call, an instance of
the unmarshalled parameter will not be assignable to instances that were defined by local
classes (i.e. never unmarshalled).
In order to work around class boomerang problems, the preferred class provider lookupLoader
algorithm is different from the analogous algorithm in LoaderHandler. To avoid boomerangs,
the lookupLoader method of this class attempts to locate the "origin" class loader of an
incoming class in a remote method call. Loading classes from their origin loader instead of
in a preferred circumvents type compatibility conflicts.
To find origin loaders, the lookupLoader method calls findOriginLoader() before locating or
creating new PreferredClassLoaders. An origin loader is found by searching up the delegation
hierarchy above the parent (context) class loader for a loader that has an export path which
matches the parameter path.