Further Technical Specifications

for the project on Design and Implementation of Basic RMI Mechanisms

by Kohei Honda

Department of Computer Science, Queen Mary and Westfield College, University of London
March 2000

I hope the following specifications and suggestions can guide you in this coursework so that you can avoid possible traps and can focus on essential technical points without spending too much time. Please read this document carefully. If you think I am saying too much, well, my apologies.

The precise method to test your RMI programs is now given (though you do not have to obey it as far as you can demonstrate essentially the same thing).  The default registry,  with interfaces and testing programs can be used. See Section 2 below (direct links are here for testing and here for the registry). The link given in Section 2.3 also offers further hints on designing your RMI.

0. What You Should Make

To think of what you need for realising RMI is one of the interesting bits of this coursework, since, in the end, you will say "aha! this is so simple indeed!". Anyway, I hope that giving a few hints to you may not spoil your fun. Here are a few suggestions.

  1. You have to make the communication module (CM) for each VM (look at Figure 5.6 in CDK3). The CM is just a program which receives an invocation from a proxy and sends it to a skeleton in another VM (in the figure, the CM communicates with another CM which receives it, unmarshalls it and sends it to a skeleton. In your programs, this does not have to be so, it is your choice.) But how does it know where that skeleton resides? That is what the remote object reference gives us (see 2.2 (1) below). The remote object table relates remote object references to actual (local) objects. A layout for remote object references is defined in CDK3 Figure 4.10 but they can have a different shape if you wish. Manipulation of remote object references is best given as a separate class. The CM itself can be divided into a few classes. It's your choice.
  2. Then what do you make? Well you need to consider how the arguments of an invocation are made into a stream (if you use a TCP socket you can just send a stream). You can do it in one of two ways. i) you can use an algorithm which is explained in CDK3 Section 4.3.2. You make a stream out of it and send it via a TCP socket. ii) you can use Java serialisation and send it via a socket simply. But if you use the second approach, Java serialisation will not treat your implementation of remote object references properly.

    My observations: the first method is interesting and stimulating. To do it would be rewarding. However if you want to be timewise economical you may use a combined method (I should stop here so that I do not tell you everything!). The marshalling methods will be called from a proxy or a CM.

  3. What else should you make? NOTHING! Except the skeletons and proxies for the test programs, which you can easily make once the interfaces of (1) and (2) above are determined. When you have done that you will understand how RMI works. (Indeed the real Java RMI uses TCP, and the skeleton and proxy are given as separate classes, though in Java 1.2 skeletons are not necessary).

So this is not as complex as you first thought: the whole code should be quite unexpectedly short. Difficulties however lie in the following: so far you have mostly been writing application programs rather than this kind of program, which requires what is often called system programming. That is, you are going to realise fundamental functionalities used for other application programs. A different kind of mind set is necessary to think in that way.

In the rest of this decument, I offer some technical specifications which should help in your decision making.

1. Technical Specification

 

2. Test Programs, Registry, Default Constructions and How Testing is Done

2.1 Test programs

Here you can find the code for a remote server and a client , which are to be used for testing your program.

2.2 Default Constructions

The following are default constructions. The subsequent suggestions etc. are based on these the default constructions. Maybe it will make your life easier to use these constructions. On the other hand, if you consider it is better, you may refine/change these constructions.

2.3 How Testing is Done

3. Further Technical Pointers