Name: pj23592 Date: 02/01/2002
Currently, exporting a remote object from J2SE RMI requires the presence of a
pre-generated stub class whose name is a function of the remote implementation
class being exported. This stub class typically must be generated as a separate
compile-time step using the "rmic" tool, and it must be made available to all
clients of the remote object through various possible means (HTTP server, file
system, etc.).
It would be very straightforward for RMI to instead use a dynamic proxy class
(obtained using the java.lang.reflect.Proxy API) for the remote stub of a remote
object being exported-- in fact, java.lang.reflect.Proxy was designed with this
application in mind, and its generated dynamic proxy classes are very similar to
the stub classes generated by "rmic" with the "-v1.2" option used. This would
require one new public class in the java.rmi APIs: a public InvocationHandler
class whose instances contain a java.rmi.server.RemoteRef instance.
Supporting the use of dynamic proxies as RMI stubs would simplify the
development and deployment of RMI applications by eliminating the "rmic" step
from the build process and by eliminating the need to provide for the
distribution of remote stub classes.
It would also facilitate exporting dynamic proxy instances as remote objects
themselves (which is currently only prevented by the need for named stub
classes), which has also been a highly requested feature-- which would allow for
more convenient logging, checking, and other server-side pre- and
post-processing handling of remote method invocations.
======================================================================