Re: Multiple codebase and inheritance
Gregg Wonderly <[email protected]> Wed, 3 May 2006 20:57:40 -0500
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
Andrea Angeloni wrote: > Ok, I'll try. > Another question: are there restrictions about remote classes (something > like serialization requirements,...), ? Can I use general classes, as I > think? The general issue is that with RMI, you have to fit your application into one of three modes of operation, purely remote, purely local, or a combination of remote and local, often called a smart proxy. All three of these involve, in native RMI terms, serialization of an object from one JVM to another. The codebases purpose is to allow the receiving JVM to make sense of the received, serialized form. As the deserialization process occurs, the RMIClassLoader is consulted to resolve classes. In RMI as delivered in the JDK, the standard classloader semantics of look to the parent first, before resolving locally are followed. In the Jini platform, we have what many people call RMI v2.0 in the form of the Jini Extensible Remote Invocation (JERI) stack. JERI makes use of a PreferredClassLoader which looks in the codebase for a file called META-INF/PREFERRED.LIST. In that file is a specification of which packages/classes are preferred (should be resolved from the codebase). Now, back to your question. You can use any class you want in your use of RMI, as long as the receiving JVM can resolve through one of the active classloaders. In order for it to work in both JVMs, you must maintain the Serialization compatiblity constraints that are documented in the JDK documentation, for any Object that the RMIClassLoader or PreferredClassLoader will resolve. You can though wrap other classes inside of a frontline class, and pickle the contents of that class in whatever way you wish. It might be that you need to have a very small, or no codebase to speed startup of a remote object, and then you create a new classloader (providing the client grants your codebase that permission) which downloads and resolves classes only at the moment they actually need to be used. Gregg Wonderly =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html