Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How class will be loaded in the server in RMI?

 
Joybrata Chakraborty
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Please help me to understand the follwoing example.
http://java.sun.com/docs/books/tutorial/rmi/overview.html

How Pi class will be loaded in the server JVM?


Joy
 
Karthik Shiraly
Bartender
Posts: 1208
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The location where Pi class is available is set using the -Djava.rmi.server.codebase=file:/c:/home/jones/public_html/classes/ command line arg on client side.
When the remote method is called, server finds that it doesn't know the class Pi whose instance is sent by this client. So the RMI infrastructure loads the classes from the codebase specified by the same client. If another client sends a class Pi2 with a different codebase, the server side will load Pi2 from the second codebase. Each client can specify its own codebase. The server also can specify its own codebase to serve classes required by clients.

This RMI code downloading tutorial explains the different scenarios well.

A great way to understand what's going on in the RMI infrastructure on server side, client side and in registry is
- start all of them with the command line arg -Djava.util.logging.config.file=rmilogging.properties
- Create this file "rmilogging.properties" in the same directory with the following contents:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic