Re: Multiple codebase and inheritance

Gregg Wonderly <[email protected]> Wed, 3 May 2006 09:46:41 -0500
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Andrea Angeloni wrote:
> Hi, this is my first message to this mailing list.
>
> I'm studying, in my thesis, the use of inheritance in distributed systems.
> I've found some RMI-based technologies, like Jini and JavaSpaces, very
> interesting for my work.
>
> I've found the feature of dynamic class downloading in RMI (using
> RMIClassloader in RMI internals, I think).
>
> The question: suppose I have a codebase defined as
>
> -Djava.rmi.server.codebase="http://site1/A/ http://site2/B/"
>
> I have a client that, according to this codebase, downloads classes from A
> and B.
>
> The question: can a class x located in B have relationships with a class y
> in A (x uses objects of y type)? In particular, can x extend y? Can the
> RMIClassloader, in the client call, "resolve" an inheritance relationship
> between remote locations?

Yes.  The use of remote codebase classloading is no different than normal java
classloading.  A class can inherit from or have reference to any other class in
the classloader hierarchy.  The important point is Class object equality demands
that the Class object be resolved by the same ClassLoader.

In the above case, the RMIClassLoader (which is a URLClassLoader) has the listed
code sources in its set of URLs.  Thus any attempt to resolve classes from the
site2 codesource will see the site1 codesource in the same (RMI) ClassLoader.

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