Class RMIClassLoaderSpi
java.lang.Object
java.rmi.server.RMIClassLoaderSpi
RMIClassLoaderSpi is the service provider interface for
RMIClassLoader.
In particular, an RMIClassLoaderSpi instance provides an
implementation of the following static methods of
RMIClassLoader:
RMIClassLoader.loadClass(URL,String)RMIClassLoader.loadClass(String,String)RMIClassLoader.loadClass(String,String,ClassLoader)RMIClassLoader.loadProxyClass(String,String[],ClassLoader)RMIClassLoader.getClassLoader(String)RMIClassLoader.getClassAnnotation(Class)
RMIClassLoader for a description
of how a provider instance is chosen.- Since:
- 1.4
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringgetClassAnnotation(Class<?> cl) Provides the implementation forRMIClassLoader.getClassAnnotation(Class).abstract ClassLoadergetClassLoader(String codebase) Provides the implementation forRMIClassLoader.getClassLoader(String).abstract Class<?> loadClass(String codebase, String name, ClassLoader defaultLoader) Provides the implementation forRMIClassLoader.loadClass(URL,String),RMIClassLoader.loadClass(String,String), andRMIClassLoader.loadClass(String,String,ClassLoader).abstract Class<?> loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader) Provides the implementation forRMIClassLoader.loadProxyClass(String,String[],ClassLoader).Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
RMIClassLoaderSpi
public RMIClassLoaderSpi()Constructor for subclasses to call.
-
-
Method Details
-
loadClass
public abstract Class<?> loadClass(String codebase, String name, ClassLoader defaultLoader) throws MalformedURLException, ClassNotFoundException Provides the implementation forRMIClassLoader.loadClass(URL,String),RMIClassLoader.loadClass(String,String), andRMIClassLoader.loadClass(String,String,ClassLoader). Loads a class from a codebase URL path, optionally using the supplied loader. Typically, a provider implementation will attempt to resolve the named class using the givendefaultLoader, if specified, before attempting to resolve the class from the codebase URL path.An implementation of this method must either return a class with the given name or throw an exception.
- Parameters:
codebase- the list of URLs (separated by spaces) to load the class from, ornullname- the name of the class to loaddefaultLoader- additional contextual class loader to use, ornull- Returns:
- the
Classobject representing the loaded class - Throws:
MalformedURLException- ifcodebaseis non-nulland contains an invalid URL, or ifcodebaseisnulland a provider-specific URL used to load classes is invalidClassNotFoundException- if a definition for the class could not be found at the specified location
-
loadProxyClass
public abstract Class<?> loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader) throws MalformedURLException, ClassNotFoundException Provides the implementation forRMIClassLoader.loadProxyClass(String,String[],ClassLoader). Loads a dynamic proxy class (seeProxythat implements a set of interfaces with the given names from a codebase URL path, optionally using the supplied loader.An implementation of this method must either return a proxy class that implements the named interfaces or throw an exception.
- Parameters:
codebase- the list of URLs (space-separated) to load classes from, ornullinterfaces- the names of the interfaces for the proxy class to implementdefaultLoader- additional contextual class loader to use, ornull- Returns:
- a dynamic proxy class that implements the named interfaces
- Throws:
MalformedURLException- ifcodebaseis non-nulland contains an invalid URL, or ifcodebaseisnulland a provider-specific URL used to load classes is invalidClassNotFoundException- if a definition for one of the named interfaces could not be found at the specified location, or if creation of the dynamic proxy class failed (such as ifProxy.getProxyClass(ClassLoader,Class[])would throw anIllegalArgumentExceptionfor the given interface list)
-
getClassLoader
Provides the implementation forRMIClassLoader.getClassLoader(String). Returns a class loader that loads classes from the given codebase URL path.- Parameters:
codebase- the list of URLs (space-separated) from which the returned class loader will load classes from, ornull- Returns:
- a class loader that loads classes from the given codebase URL path
- Throws:
MalformedURLException- ifcodebaseis non-nulland contains an invalid URL, or ifcodebaseisnulland a provider-specific URL used to identify the class loader is invalid
-
getClassAnnotation
Provides the implementation forRMIClassLoader.getClassAnnotation(Class). Returns the annotation string (representing a location for the class definition) that RMI will use to annotate the class descriptor when marshalling objects of the given class.- Parameters:
cl- the class to obtain the annotation for- Returns:
- a string to be used to annotate the given class when
it gets marshalled, or
null - Throws:
NullPointerException- ifclisnull
-