Skip navigation links

Package net.jini.loader.pref

Provides class loader and RMIClassLoader provider implementations that support preferred classes.

See: Description

Package net.jini.loader.pref Description

Provides class loader and RMIClassLoader provider implementations that support preferred classes.

A preferred class is a class that is to be loaded by a class loader without the loader delegating to its parent class loader first. Resources may also be preferred.

With a class loader that supports preferred classes, the first JAR file or other URL location from which the loader loads classes can contain a preferred list. A preferred list declares names of certain classes and other resources throughout the loader's path of URLs as being preferred or not. When the loader is asked to load a class or resource that is preferred (according to the preferred list) and the class or resource exists in the loader's path of URLs, the loader will not delegate first to its parent class loader as it otherwise would do; instead, it will attempt to load the class or resource from its own path of URLs only.

By controlling class loader delegation, preferred classes can help accomplish the following goals:

Preferred classes accomplish these goals at the expense of type equivalence with local classes, because a preferred class constitutes a different runtime type than a local class with the same name that might otherwise have been loaded. Therefore, the choice of which classes to make preferred should be considered carefully.

There is not a complete or definitive set of rules for when to make a class or resource preferred or not, but the following guidelines are generally advisable:

PreferredClassLoader is a class loader implementation that supports preferred classes, and its specification defines the format of preferred lists.

PreferredClassProvider is an RMIClassLoader provider implementation that uses PreferredClassLoader to support preferred classes.

RequireDlPermProvider is a subclass of PreferredClassProvider that enforces DownloadPermission.

Skip navigation links

Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.