MatlabRMIClassLoaderSpi¶
-
public class
MatlabRMIClassLoaderSpi
extends RMIClassLoaderSpi¶ Internal Use Only This class must be public so that it can be created via reflection by
RemoteClassLoader
. If it were package private it would result in anIllegalAccessError
because only classes in the same package as a package private class may construct it (even via reflection). It has been placed in thematlabcontrol.internal
package to make it clear it is not intended for use by users of matlabcontrol. A custom service provider for the RMI class loader. Allows for loading classes sent from the external JVM and providing annotations so that the external JVM may load classes defined only in the MATLAB JVM. Loading classes from the external JVM could be accomplished by settingjava.rmi.server.codebase
property in the external JVM but that could interfere with other uses of RMI in the application. There is no way to always sending the correct annotations without this custom rmi class loader spi. While thejava.rmi.server.codebase
property could be set in the MATLAB JVM, the property is checked only at load time. This would mean that class definitions added dynamically withjavaaddpath
could not be sent.Author: Joshua Kaplan
Methods¶
getClassAnnotation¶
-
public String
getClassAnnotation
(Class<?> clazz)¶ {@inheritDoc} The returned annotation becomes the
codebase
argument inloadClass(java.lang.String,java.lang.String,java.lang.ClassLoader)
when theRMIClassLoaderSpi
in the receiving JVM attempts to loadclazz
. This allows for classes defined in MATLAB but not in the receiving JVM to find and load the class definition.Parameters: - clazz –
getClassLoader¶
-
public ClassLoader
getClassLoader
(String codebase)¶