LoaderHandler
provides the implementation of the static
methods of the java.rmi.server.RMIClassLoader
class.
Modifier and Type | Class and Description |
---|---|
private static class | LoaderHandler.
Loader is the actual class of the RMI class loaders created by the RMIClassLoader static methods. |
private static class | LoaderHandler.
LoaderEntry contains a weak reference to an RMIClassLoader. |
private static class | LoaderHandler.
LoaderKey holds a codebase URL path and parent class loader pair used to look up RMI class loader instances in its class loader cache. |
Modifier and Type | Field and Description |
---|---|
private static final Map | 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 | |
private static final HashMap | loaderTable
table mapping codebase URL path and context class loader pairs to class loader instances. |
pack-priv static final int | logLevel
RMI class loader log level |
private static final Map | pathToURLsCache
map from weak(key=string) to [URL[], soft(key)] |
private static final ReferenceQueue | refQueue
reference queue for cleared class loader entries |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private static void | addPermissionsForURLs(URL[] urls, PermissionCollection perms, boolean forLoader)
Adds to the specified permission collection the permissions necessary to load classes from a loader with the specified URL path; if "forLoader" is true, also adds URL-specific permissions necessary for the security context that such a loader operates within, such as permissions necessary for granting automatic permissions to classes defined by the loader. |
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 a classloader that loads classes from the given codebase URL path. |
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. |
private static AccessControlContext | getLoaderAccessControlContext(URL[] urls)
References Deprecated
AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.
Return the access control context that a loader for the given codebase URL path should execute with. |
private static ClassLoader | getRMIContextClassLoader()
Return the class loader to be used as the parent for an RMI class loader used in the current execution context. |
public static Object | |
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 | |
private static Class | |
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 LoaderHandler. | lookupLoader(final URL[] urls, final ClassLoader parent)
Look up the RMI class loader for the given codebase URL path and the given parent class loader. |
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. |
codebaseLoaders | back to summary |
---|---|
private static final Map<ClassLoader, Void> codebaseLoaders table of class loaders that use codebase property for annotation |
codebaseProperty | back to summary |
---|---|
private static String codebaseProperty value of "java.rmi.server.codebase" property, as cached at class initialization time. It may contain malformed URLs. |
codebaseURLs | back to summary |
---|---|
private static URL[] codebaseURLs list of URLs represented by the codebase property, if valid |
loaderLog | back to summary |
---|---|
pack-priv static final Log loaderLog |
loaderTable | back to summary |
---|---|
private static final HashMap<LoaderHandler. table mapping codebase URL path and context class loader pairs to class loader instances. Entries hold class loaders with weak references, so this table does not prevent loaders from being garbage collected. |
logLevel | back to summary |
---|---|
pack-priv static final int logLevel RMI class loader log level
|
pathToURLsCache | back to summary |
---|---|
private static final Map<String, Object[]> pathToURLsCache map from weak(key=string) to [URL[], soft(key)] |
refQueue | back to summary |
---|---|
private static final ReferenceQueue<LoaderHandler. reference queue for cleared class loader entries |
LoaderHandler | back to summary |
---|---|
private LoaderHandler() |
addPermissionsForURLs | back to summary |
---|---|
private static void addPermissionsForURLs(URL[] urls, PermissionCollection perms, boolean forLoader) Adds to the specified permission collection the permissions necessary to load classes from a loader with the specified URL path; if "forLoader" is true, also adds URL-specific permissions necessary for the security context that such a loader operates within, such as permissions necessary for granting automatic permissions to classes defined by the loader. A given permission is only added to the collection if it is not already implied by the collection. |
getClassAnnotation | back 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. |
getClassLoader | back to summary |
---|---|
public static ClassLoader getClassLoader(String codebase) throws MalformedURLException Returns a classloader that loads classes from the given codebase URL path. The parent classloader of the returned classloader is the context class loader. |
getDefaultCodebaseURLs | back 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. |
getLoaderAccessControlContext | back to summary |
---|---|
private static AccessControlContext getLoaderAccessControlContext(URL[] urls)
References Deprecated
See corresponding docs for further information. Return the access control context that a loader for the given codebase URL path should execute with.
|
getRMIContextClassLoader | back to summary |
---|---|
private static ClassLoader getRMIContextClassLoader() Return the class loader to be used as the parent for an RMI class loader used in the current execution context. |
getSecurityContext | back to summary |
---|---|
public static Object getSecurityContext(ClassLoader loader) Return the security context of the given class loader. |
loadClass | back to summary |
---|---|
public static Class Load a class from a network location (one or more URLs), but first try to resolve the named class through the given "default loader". |
loadClass | back to summary |
---|---|
private static Class Load a class from the RMI class loader corresponding to the given codebase URL path in the current execution context. |
loadClassForName | back to summary |
---|---|
private static Class |
loadProxyClass | back to summary |
---|---|
public static Class 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. |
loadProxyClass | back to summary |
---|---|
private static Class 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. |
loadProxyClass | back to summary |
---|---|
private static Class Define a proxy class in the given class loader. The proxy class will implement the given interfaces Classes. |
loadProxyInterfaces | back to summary |
---|---|
private static ClassLoader loadProxyInterfaces(String[] interfaces, ClassLoader loader, Class<?>[] classObjs, boolean[] nonpublic) throws ClassNotFoundException |
lookupLoader | back to summary |
---|---|
private static LoaderHandler. Look up the RMI class loader for the given codebase URL path and the given parent class loader. A new class loader instance will be created and returned if no match is found.
|
pathToURLs | back 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. |
registerCodebaseLoader | back 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. |
urlsToPath | back 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. |
Modifier and Type | Field and Description |
---|---|
private String | annotation
string form of loader's codebase URL path, also an optimization |
private ClassLoader | parent
Hides java. |
private Permissions | permissions
permissions required to access loader through public API |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private void | checkPermissions()
Check that the current access control context has all of the permissions necessary to load classes from this loader. |
public String | getClassAnnotation()
Return the string to be annotated with all classes loaded from this class loader. |
protected PermissionCollection | getPermissions(CodeSource
the codesource codesource)Overrides java. Return the permissions to be granted to code loaded from the given code source. |
protected Class | loadClass(String
The binary name of the class name, boolean If resolve)true then resolve the classOverrides java. Loads the class with the specified binary name. |
public String | toString()
Overrides java. Return a string representation of this loader (useful for debugging). |
annotation | back to summary |
---|---|
private String annotation string form of loader's codebase URL path, also an optimization |
parent | back to summary |
---|---|
private ClassLoader parent Hides java. parent class loader, kept here as an optimization |
permissions | back to summary |
---|---|
private Permissions permissions permissions required to access loader through public API |
Loader | back to summary |
---|---|
private Loader(URL[] urls, ClassLoader parent) |
checkPermissions | back to summary |
---|---|
private void checkPermissions() Check that the current access control context has all of the permissions necessary to load classes from this loader. |
getClassAnnotation | back to summary |
---|---|
public String getClassAnnotation() Return the string to be annotated with all classes loaded from this class loader. |
getPermissions | back to summary |
---|---|
protected PermissionCollection getPermissions(CodeSource codesource) Overrides java. Return the permissions to be granted to code loaded from the given code source.
|
loadClass | back to summary |
---|---|
protected Class Overrides java. Doc from java. Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:
If the class was found using the above steps, and the
Subclasses of Unless overridden, this method synchronizes on the result of
|
toString | back to summary |
---|---|
public String toString() Overrides java. Return a string representation of this loader (useful for debugging).
|
Modifier and Type | Field and Description |
---|---|
public LoaderHandler. | |
public boolean | removed
set to true if the entry has been removed from the table because it has been replaced, so it should not be attempted to be removed again |
Access | Constructor and Description |
---|---|
public |
key | back to summary |
---|---|
public LoaderHandler. |
removed | back to summary |
---|---|
public boolean removed set to true if the entry has been removed from the table because it has been replaced, so it should not be attempted to be removed again |
LoaderEntry | back to summary |
---|---|
public LoaderEntry(LoaderHandler. |
Modifier and Type | Field and Description |
---|---|
private int | |
private ClassLoader | |
private URL[] |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
public int |
hashValue | back to summary |
---|---|
private int hashValue |
parent | back to summary |
---|---|
private ClassLoader parent |
urls | back to summary |
---|---|
private URL[] urls |
LoaderKey | back to summary |
---|---|
public LoaderKey(URL[] urls, ClassLoader parent) |
equals | back to summary |
---|---|
public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
|
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
|