Technology Security Java Rmi Remote Method Invocation Computer Science Essay

Published: Last Edited:

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

The grid technology is a classical combination of number of personal computers in multiple network environment administrating domain to achieve a specific task in a great way. This technology is basically works on different algorithm problems related to some business, there really have the great size of CPUs to produce or process a great total of pattern.

There are so many methods in this technology, which makes a load of work less for the Personal Computers, in other words when thousands of computers works for the same intention at same time system becomes down to work because of huge rush of data, so this technology enables a computers to do the same job quickly enormous way with the help of distributed environment multithreading. There is a one other name for this technology and that is GCD which does the great amount of work with cluster method. By using this technology we can have a connected and integrated environment to precede the work, like in network system but while we uses that network it makes the process faster because it allocates a threads to each computers to perform a different type of task at the same time, but then computer will work in a thread as there is allocation so it may happen that there could be a different time to perform a different operation for all computers. Generally a volume of grid computing differs from data to data. It can be diverse as is it tiny or very big cramped network system or there is a option to have a huge network under the global business.

Grid technology has great feature and that is to have a one main powerful workstation working on a clustering of connected computers, which works on a proceeding a huge work of amount. It can work on all type of operation without charging anything like logical, arithmetic and so on.

Java RMI (Remote Method Invocation)

JAVA is a objected oriented programming structure language. Java has many features like API, Packages. Java has application programming interface named RMI. The Java RMI is an application programming interface that performs objects oriented calls corresponding to remote procedure calls.

RMI allows application to call object technique located remotely, dividing resources and dealing out weight across system. Not like diverse systems for remote execution which need that only plain data types of distinct structure be passes to and from methods.

You can use any java object type to use RMI. Even if main system or client system has never encountered it earlier than. Remote method invocation permits dynamically freight original object types as necessary.


Assume that the computer programmer John develops a program that which has come helpful purpose. All the time he updates his program, he adds a new feature to his program. Now its time to assume that one another computer programmer Martin want to use the program developed by John. It is bit difficult for John to send the updates of a developed program all the time.

Don't worry, here is solution. Java RMI provides additional easy solution Java RMI can load new classes dynamically, now Martin can handle his program on his own computer with the updates, but for that developer John need to create a web directory where he can upload the updates of his program, and from the web directory RMI can fetch all the updates as per Martin's requirement.

As you can see in this picture the client is in contact with rmi registry at first it must for the client to send request as name of the service. At this time Martin doesn't know the actual location of the service, but he has a knowledge that how to make a contact of programmer John's registry, from here he can ask for the desired services.

John makes changes in his program everyday; therefore Martin might not have a print of the class. Now the client's computer will automatically fetch the subclasses from the web server where John and Martin share their classes. Now there is a one new class coming in memory, and the martin is ready to use that particular class. This all process is visible to Martin, there is no need to write any extra program to fetch the updated class.

What is an RMI service?

the rmi services is bit difficult when you are going to write it at first time, so I am just about to give an example of it, which is not really grand. I would like to crate a service that could calculate a square, multiplication, addition, subtraction and etc.

This is the view of the application that how the system works with client and server application. There are mainly two thing s to consider as a main things

The Client has a subclass named stubs, whenever the client sends a request to server the stub class forward it to the RRL and then the RRL forward its to the transport means now the request is in a queue as soon as the server feels free it will consider the request and then it will perform a appropriate operation as the request is. Now its Server turns to send a feedback to the client using its own Skeleton class which is in contact with the RRL, and RRL is in to the network now the transport will receive the feedback from server and then the transport will send the feedback to the desired client that their request is been confirmed.

RMI based Client -Server Application

Currently in this subsequent development I will be generous writing a Java RMI-based Client and Server based application where I will be using multithreaded Server which in fact serves desires of remote Java Clients for the stage some of the mathematical operations. This is truly departing to be a especially superior RMI based client and server application where one user has to add an integer value from the keyboard. This capitulation will allow users to make the following take action: Add, Subtraction, Multiply, Square, etc

The code below contains all the functions to be executed from a client as exClient.

package Rahul.example;

import java.rmi.registry.LocateRegistry;

import java.rmi.registry.Registry;

import java.util.Scanner;

public class exClient


public static void main(String[] args)


String host = (args.length < 1) ? null : args[0];



Scanner in = new Scanner(;

System.out.println("Input first Integer.");

int a=in.nextInt();

System.out.println("Input second Integer.");

int b=in.nextInt();

Registry registry'' = LocateRegistry.getRegistry(host);

exServer ''stub'' = (exServer) ''registry.lookup("''exServer");

int response = stub.sum(a, b);

int response1 = stub.sub(a, b);

int response2 = stub.mul(a, b);

int response3 = stub.square(a, b);

System.out.println("The Sum is: " + response);

System.out.println("The Sub is: " + response1);

System.out.println("The Mul is: " + response2);

System.out.println("The'' Square ''is: " + response3);


catch (Exception e)


System.err.println("Client exception: " + e.toString());





The code here below is a code for a server side programming where all the required functions are declared, name of the server is ex Server.

Package Rahul.example;

import java.rmi.Remote;

import java.rmi.RemoteException;

public interface exServer extends Remote


public int sum(int a,int b) throws RemoteException;

public int sub(int c,int d) throws RemoteException;

public int mul(int e,int f) throws RemoteException;

public int square(int g,int h) throws RemoteException;


The following is the Code for Server as ServerImpl where the functions are implemented.

package Rahul.example;

import java.rmi.registry.LocateRegistry;

import java.rmi.registry.Registry;

import java.rmi.server.UnicastRemoteObject;

public class SampleServerImpl implements exServer {

Sample ServerImpl(){


public int sum(int a, int b)


return a + b;


public int sub(int c, int d)


return c-d;


public int mul(int e, int f)


return e*f;


public int square(int g, int h)


return (g*h)/2;


public static void main(String args[])


try {


//Create and export a remote object

SampleServerImpl obj = new SampleServerImpl();

exServer stub = (exServer)UnicastRemoteObject.exportObject(obj, 0);

//''Register the remote ''object with a Java RMI ''registry

//''and bind the'' remote object's'' stub in the registry''

Registry registry = Locate Registry.getRegistry();

registry.bind("exServer", stub);

System.''err.println("Server ready");


catch (Exception e)


System.err.println("Server exception: " + e.toString());






This application can full fill the all requirement of client server communication in the way of addition, subtraction, multiplication, and square.

The server plays a main role this whole procedure, because all the function is implemented here.

Once you run the server application, you need to run the command prompt in background window and within a sometime the user will get message that the "Server is ready."

Now its run to execute a client application.

Here the user will be asked for entering the desired integer value, and it will be forwarded to the server where is evaluation process completed.

Once the process is started it will be in a use for a consistent use, and then client comes in process displays all the desired result in command prompt.

The tool and languages used to develop this application are as folloe:

Java Object oriented programming language

Java RMI

3. Multithreading Programing