wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question regarding RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question regarding RMI" Watch "Question regarding RMI" New topic
Author

Question regarding RMI

Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361
I am doing "the bodgit and scraper" assigment
my assignment says :

I must use RMI over JRMP
and it says no class loading should occur.

I just want to make sure for these things
1-using the RMI tool will generate skeleton and stub files
2-The stub files encapsulate the network functionality and are the actual
ones that will be put in the rmi registry.
2-When the client uses the Naming.lookup the client gets a copy of the
stub class from the server. (Is this the class loading the assignment talks about?
3-What is the skeleton used for??
4-If want to put the stub files on the client applications,where to put
them and do i need anything to load them to the client application.

Another thing made worry about the assigment
In the deliverables part of the assignment there is a statement:


When you submit your assignment, each part (client and server) must be executable using a command of this exact form:

In the case in which there is no networking,the client and server will run
with a single command.

The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run.


The server mode runs the GUI application configured to work with the networked mode.The "alone" or not providing a mode at all will run the client application to be configured to work with local file.
Is this true??

[ October 09, 2006: Message edited by: Khaled Mahmoud ]
[ October 09, 2006: Message edited by: Khaled Mahmoud ]

SCJP, SCJD,SCWCD,SCDJWS,SCEA 5 MCP-C#, MCP-ASP.NET - http://www.khaledinho.com/
Life is the biggest school
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961

Using the RMI tool will generate skeleton and stub files


Stubs and Skeletons are generated by the rmic compiler that comes with the JDK and that is located in the bin directory.

Now, if you are using JDK1.4 you just need to generate the Stubs, and if you are using JDK1.5 you do not need to generate anything (See Ehhancements in J2SE 5.0


2-The stub files encapsulate the network functionality and are the actual
ones that will be put in the rmi registry.


You need to read the RMI Specification. It has a chapter on Skelentons and Stubs and explain their purpose.


2-When the client uses the Naming.lookup the client gets a copy of the
stub class from the server. (Is this the class loading the assignment talks about?


Code mobility may happen for different reasons. For instance, the server does not have the class for one of the parameter that you are passing to a method, or you client does not have the class for one of the obejcts returned from a remote method. In those cases, RMI can download the class files from a code repository defined for the RMI system.

Once again, read RMI Specification about this. But the bottom line is that your application must not require this service.

Now, you should not have this problem with your implementation of the assignment since all the code for both, client and server, will be stored in the same jar file (runme.jar).


3-What is the skeleton used for??


You really need to read the RMI Specification.


4-If want to put the stub files on the client applications,where to put
them and do i need anything to load them to the client application.


All your code will be deployed in a single jar file, name runme.jar (at least in my assignment). If you generate Stubs and Skeletons, those should be there.


The server mode runs the GUI application configured to work with the networked mode.The "alone" or not providing a mode at all will run the client application to be configured to work with local file.
Is this true??


There are four possible scenarios:

1. java -jar runme.jar server
2. java -jar runme.jar
3. java -jar runme.jar standalone
4. java -jar runme.jar xyz

In the first scenario, you must run start the RMI server. The client application will not start at this point. But you may require some UI to confirm the server parameters, like what port will you be using, where is the database file, etc.

In the second scenario you must start the "netwok-aware" client application. You will have to ask the user what server and what port he wants to use to connect to the application. Evidently, you server must have been started previously.

In the third scenario the client application starts, but instead of connecting to the server, it creates local objects to manipulate the datbase. Namely, instead of requisting the objects from the RMI Registry, you actually create the instance of your database objects and use them in the local JVM. In good theory you should be able to use the same objects that you typically register in the RMI Registry, but this time just locally.

In the fourth scenario the user provides wrong input, then you could display a command help message explaining the user the right options.
[ October 09, 2006: Message edited by: Edwin Dalorzo ]
 
GeeCON Prague 2014
 
subject: Question regarding RMI