RMI downloads ALL classes or just subclasses?

H

hitectahir

Hi,

Could someone please clear up this little question of mine regarding
RMI's dynamic code downloading features?

RMI claims that it can download ALL classes required by a stub to the
client using the java.rmi.server.codebase property. However, it seems
to be that this is not the case. It seems to me that in the remote
interface, the class (say X) that you specify as a return type or
parameter type must also be available to the client in its local
CLASSPATH. The client cannot download this class using the remote
codebase.

What the server can do is define some subclasses of X and return (or
allow passing of) objects of the subclasses instead of X. These
subclasses are the ones which can be downloaded by clients, and loaded
at runtime using the remote codebase.

Please tell me if Im wrong, and if there might be some way of allowing
ANY class to be downloaded to the client from the RMI server.

Regards
Tahir.
 
E

Esmond Pitt

hitectahir said:
It seems to me that in the remote
interface, the class (say X) that you specify as a return type or
parameter type must also be available to the client in its local
CLASSPATH. The client cannot download this class using the remote
codebase.

What the server can do is define some subclasses of X and return (or
allow passing of) objects of the subclasses instead of X. These
subclasses are the ones which can be downloaded by clients, and loaded
at runtime using the remote codebase.

Please tell me if Im wrong, and if there might be some way of allowing
ANY class to be downloaded to the client from the RMI server.

Well, there is, you could just use Object as the return type, and all
the necessary classes including the stub and the remote interface will
be downloaded if available. However, what are you going to do then?
Without using introspection there is no way you can use the remote
interface just downloaded, as the moment you use its name in your client
source code it has to be available via the client's CLASSPATH.

What exactly are you trying to achieve?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top