Edge7
Edge7

Reputation: 681

RMI theory , download stub file

When a Client asks for a remote reference to a RMIregistry, Rmiregistry sends to Client an instance of the stub class, the client need also the definition of this class (.class) .

Client asks for stub.class to Rmiregistry or Rmiregistry sends it automatically ?

Using codebase property Can I force Client to download stub.class from a my webserver?

Thanks

**EDIT: It seems like if I generate stub file with rmic , then client tries to download them, if I don't use rmic client doesn't download stub, but my program works.

Can you explain this?

**FINAL EDIT: Ok, I think to have understood. Thanks to EJP

Regards

Upvotes: 0

Views: 1229

Answers (1)

user207421
user207421

Reputation: 310850

Client asks for stub.class to Rmiregistry or Rmiregistry sends it automatically ?

Neither. Either the client already has the class in its CLASSPATH or it downloads it from the codebase server if there is one. The Registry has nothing to do with it either way.

Using codebase property Can I force Client to download stub.class from a my webserver?

Well, that's what it's for. It's the only thing it's for. Note that it has to be set at the RMI server JVM.

It seems like if I generate stub file with rmic , then client tries to download them, if I don't use rmic client doesn't download stub, but my program works.

If you satisfy the conditions outlined in the class description in the Javadoc for UnicastRemoteObject you don't need to generate stubs at all.

Upvotes: 1

Related Questions