APIdia Launch Partner
Top Description Fields Constructors Methods
sun.rmi.server

public final Class LoaderHandler

extends Object
Class Inheritance
Annotations
@SuppressWarnings:deprecation
Imports
java.lang.ref.SoftReference, java.lang.reflect.Modifier, .Proxy, java.net.MalformedURLException, .URL, .URLClassLoader, java.rmi.server.LogStream, java.util.Arrays, .Collections, .IdentityHashMap, .Map, .StringTokenizer, .WeakHashMap, sun.rmi.runtime.Log

LoaderHandler provides the implementation of the static methods of the java.rmi.server.RMIClassLoader class.
Authors
Ann Wollrath, Peter Jones, Laird Dornin

Field Summary

Modifier and TypeField and Description
private static final Map<ClassLoader, Void>
codebaseLoaders

table of class loaders that use codebase property for annotation

private static String
codebaseProperty

value of "java.rmi.server.codebase" property, as cached at class initialization time.

private static URL[]
codebaseURLs

list of URLs represented by the codebase property, if valid

pack-priv static final Log
pack-priv static final int
logLevel

RMI class loader log level

private static final Map<String, Object[]>
pathToURLsCache

map from weak(key=string) to [URL[], soft(key)]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static String
getClassAnnotation(Class<?> cl)

Returns the class annotation (representing the location for a class) that RMI will use to annotate the call stream when marshalling objects of the given class.

public static ClassLoader
getClassLoader(String codebase)

Returns the thread context classloader.

private static synchronized URL[]
getDefaultCodebaseURLs()

Returns an array of URLs initialized with the value of the java.rmi.server.codebase property as the URL path.

public static Class<?>
loadClass(String codebase, String name, ClassLoader defaultLoader)

Load a class from a network location (one or more URLs), but first try to resolve the named class through the given "default loader".

private static Class<?>
loadClass(URL[] urls, String name)

Load a class from the RMI class loader corresponding to the given codebase URL path in the current execution context.

public static Class<?>
loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader)

Define and return a dynamic proxy class in a class loader with URLs supplied in the given location.

private static Class<?>
loadProxyClass(String[] interfaceNames, ClassLoader defaultLoader, ClassLoader codebaseLoader, boolean preferCodebase)

Define a proxy class in the default loader if appropriate.

private static Class<?>
loadProxyClass(ClassLoader loader, Class<?>[] interfaces)

Define a proxy class in the given class loader.

private static ClassLoader
loadProxyInterfaces(String[] interfaces, ClassLoader loader, Class<?>[] classObjs, boolean[] nonpublic)

private static URL[]
pathToURLs(String path)

Convert a string containing a space-separated list of URLs into a corresponding array of URL objects, throwing a MalformedURLException if any of the URLs are invalid.

public static void
registerCodebaseLoader(ClassLoader loader)

Register a class loader as one whose classes should always be annotated with the value of the "java.rmi.server.codebase" property.

private static String
urlsToPath(URL[] urls)

Convert an array of URL objects into a corresponding string containing a space-separated list of URLs.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

codebaseLoadersback to summary
private static final Map<ClassLoader, Void> codebaseLoaders

table of class loaders that use codebase property for annotation

codebasePropertyback to summary
private static String codebaseProperty

value of "java.rmi.server.codebase" property, as cached at class initialization time. It may contain malformed URLs.

codebaseURLsback to summary
private static URL[] codebaseURLs

list of URLs represented by the codebase property, if valid

loaderLogback to summary
pack-priv static final Log loaderLog
logLevelback to summary
pack-priv static final int logLevel

RMI class loader log level

pathToURLsCacheback to summary
private static final Map<String, Object[]> pathToURLsCache

map from weak(key=string) to [URL[], soft(key)]

Constructor Detail

LoaderHandlerback to summary
private LoaderHandler()

Method Detail

getClassAnnotationback to summary
public static String getClassAnnotation(Class<?> cl)

Returns the class annotation (representing the location for a class) that RMI will use to annotate the call stream when marshalling objects of the given class.

getClassLoaderback to summary
public static ClassLoader getClassLoader(String codebase) throws MalformedURLException

Returns the thread context classloader. The codebase argument is ignored.

getDefaultCodebaseURLsback to summary
private static synchronized URL[] getDefaultCodebaseURLs() throws MalformedURLException

Returns an array of URLs initialized with the value of the java.rmi.server.codebase property as the URL path.

loadClassback to summary
public static Class<?> loadClass(String codebase, String name, ClassLoader defaultLoader) throws MalformedURLException, ClassNotFoundException

Load a class from a network location (one or more URLs), but first try to resolve the named class through the given "default loader".

loadClassback to summary
private static Class<?> loadClass(URL[] urls, String name) throws ClassNotFoundException

Load a class from the RMI class loader corresponding to the given codebase URL path in the current execution context.

loadProxyClassback to summary
public static Class<?> loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader) throws MalformedURLException, ClassNotFoundException

Define and return a dynamic proxy class in a class loader with URLs supplied in the given location. The proxy class will implement interface classes named by the given array of interface names.

loadProxyClassback to summary
private static Class<?> loadProxyClass(String[] interfaceNames, ClassLoader defaultLoader, ClassLoader codebaseLoader, boolean preferCodebase) throws ClassNotFoundException

Define a proxy class in the default loader if appropriate. Define the class in an RMI class loader otherwise. The proxy class will implement classes which are named in the supplied interfaceNames.

loadProxyClassback to summary
private static Class<?> loadProxyClass(ClassLoader loader, Class<?>[] interfaces) throws ClassNotFoundException

Define a proxy class in the given class loader. The proxy class will implement the given interfaces Classes.

loadProxyInterfacesback to summary
private static ClassLoader loadProxyInterfaces(String[] interfaces, ClassLoader loader, Class<?>[] classObjs, boolean[] nonpublic) throws ClassNotFoundException
pathToURLsback to summary
private static URL[] pathToURLs(String path) throws MalformedURLException

Convert a string containing a space-separated list of URLs into a corresponding array of URL objects, throwing a MalformedURLException if any of the URLs are invalid.

registerCodebaseLoaderback to summary
public static void registerCodebaseLoader(ClassLoader loader)

Register a class loader as one whose classes should always be annotated with the value of the "java.rmi.server.codebase" property.

urlsToPathback to summary
private static String urlsToPath(URL[] urls)

Convert an array of URL objects into a corresponding string containing a space-separated list of URLs. Note that if the array has zero elements, the return value is null, not the empty string.