Heart Of Java RMI Interfaces Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In the urging web based world Java RMI plays an important role in all kind of web applications. Java Remote Method Invocation (Java RMI) is a powerful technology which provides distributed computing for web based application. It promotes the network programming towards higher level.

First it was introduced from Sun Microsystem's JDK version 1.1 and upgraded in JDK version 2.

Indeed RMI is derived from Java's Remote Procedural Call (RPC) mechanism.

Java RMI easily overtakes other distributed technologies like Common Object Request Broker Architecture (CORBA) and Distributed Common Object Model (DCOM).

Java RMI is basically platform independent (runs in any Operating System).

Java RMI

RMI is a distributed object model for java programming. RMI System is a combination of Client and Server programming.

The main goal of Java RMI is creating RMI program with usual syntax (used for single Java Virtual Machine) rather than using a specific kind of syntax for distributed programming (Deals with Multiple Java Virtual Machine).

RMI allows user (Client) to call a method on remote object which resides in different JVM (Server).

RMI used to produce some number of remote objects from a system (Server), which can be accessible remotely from other systems (Clients).

Heart of Java RMI: Interfaces

Interface:

In Java Programming language, interfaces only contain the methods without body. And the implementation (Method Definition) of the method will be overridden by the implemented class. In Java an interface can be implemented by any number of classes.

Interfaces are defined as the heart of RMI programming. Because the main concept of the RMI programming is kept the definition (interface) of a behaviour and implementation of that behaviour apart from each other.

RMI allows to run these two concepts seperatly from two different JVMS as figure shows.

Figure 1

So the important point to remember in RMI is

Interface defines the behaviour.

Classes define the implementation of that behaviour.

In Java RMI the interface (Client Side) is implemented particularly by two classes.

The class from server side which implements the interface.

A proxy class from client side (stub).

Java RMI Architecture

Figure 2: Java RMI Architecture

Architecture Overview

RMI system works on top of Java Virtual Machine. So it got the benefits of default java function to RMI system like garbage collection, class loader and security. RMI architecture contains the following layers to full fill the Communication.

Stub/Skeleton

Both the stub and skeleton layer just falls under the scope of java programmers. This layer checks the calls initiated by client to the reference variable of interface and divert these calls to remote RMI Service.

Remote Reference layer

The importance of this layer is to solve and govern the references which are initiated by the client to the remote service object. It also provides the invocation behaviour (unicast and multicast).

Transport Layer

This layer provides the connectivity function between client and server using TCP/IP protocol. It also provides few firewall penetration approaches.

Distributed Garbage Collection

This feature clears the remote server objects from the heap (memory) which all are no longer concerned by any clients in a network. This is the default function provided by java for its applications.

Stub/Skeleton:

RMI works on proxy design pattern.

Based on this design pattern Stub plays the role of proxy and the class which implements the remote service plays the role of Realsubject().

So in RMI system client uses the stub (proxy) to call a method on remote server objects.

The main role of stub is marshals the arguments of the call method.

Then by using remote reference layer stub forwards the remote invocation request to the server.

Figure 3

Skeleton used to convert the stub call to actual method call.

Skeleton check the stub calls (proxy) parameters and produce the actual method call with respect to it. This is known as un-marshalling.

After the call processed in server side skeleton return the value (marshals) to client side stub through remote reference layer.

Since JDK version 2 this skeleton class is discarded by a new wire protocol. So skeleton class need not to include in Java RMI unless we use JDK version 1.1.

Remote Reference Layer

This layer indicates the semantics of the type of remote invocation.

The semantics may be unicast or multicast.

Java version 1.1 only supports for unicast (point to point communication) between client and server.

Using RemoteRef object this layer explains the link to remote service implementation object.

With RemoteRef object stub calls the invoke() method to forward the method call through this layer.

Transport Layer

This layer is responsible for the connectivity between client and server.

The connection type provided by this layer is mostly stream based TCP/IP connection.

This TCP/IP connection provides constant, stream based link between server and client.

Earlier RMI uses a wire level protocol called Java Remote Method Protocol (JRMP) on top of TCP/IP to transfer data between two java virtual machines.

Figure 4: Transport Layer

But in later versions Java RMI introduce RMI-IIOP protocol rather than using JRMP. It reduces the work of Skeleton actually it removes the skeleton from the structure.

IIOP is nothing but Object Management Group's Internet Inter-ORB Protocol (IIOP).

ORB is nothing but Object Request Broker.

This protocol is derived from the combination of RMI and CORBA where CORBA is Object Management Group's model of distributed Technology.

Even if client and server running on the same java virtual machine, they must follow this TCP/IP connectivity rules with RMI-IIOP.

Naming Remote Objects

Before client going to make request to a remote object, on server side the remote service should be initiated and loaded to RMI System and also it should be named and registered to directory service.

By using the naming or directory service client will identify the remote service.

By default RMI itself provides a directory service called Java RMI Registry. But RMI can utilize any kind of directory service including Java Naming and Directory Interface (JNDI).

Flow of RMI System

The following figure shows the RMI data flow when a client make a remote method invocation.

Server initiates it RMI Service by implements the service through local object and export it to RMI system and creates listening service to that object which will wait for client request to process. Then it registers the object by RMI registry.

Client looking for RMI service and made query by using lookup () method, which derived from static Naming class.

Usually this method approves URL that show the server details like host name, service type and the name of the service. This URL model is shown here.

rmi://<host_name>[:<name_service_port>]/<service_name>

This method returns a remote reference to the service object.

3. Then client make a call to the remote object with that reference through stub.

4. Stub reads the parameters from client method, then marshals the data and transfers the data to server side through transport layer.

5. Skeleton reads the data from link and unmarshal it to real call to Remote object.

6. The processed return value is sent to skeleton.

7. Skeleton marshals the data again and transfers through transport layer.

8. Stub receives the return value from link and forwards it to client.

Steps to develop RMI program

Steps to Implement Java RMI

Advantages and Disadvantages

Conclusion

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.