0% found this document useful (0 votes)
23 views11 pages

Chapter2 Part3

Hi i love u

Uploaded by

amar.bakhti22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views11 pages

Chapter2 Part3

Hi i love u

Uploaded by

amar.bakhti22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Chapter 2

Distributed Information Systems


Presented by: Dr. R. BENTRCIA
Department of Computer Science, M’sila University
Outline

• RMI Application Example:


• The Remote Interface
• The Server Application
• The Client Application
• Running the RMI Application
12/23/2020 2
RMI Application Example

• In the distributed Hello World example, a client makes a remote method call
to the server, to retrieve the message "Hello world!".
• We have followed all the 6 steps to create and run this RMI application.
• The application consists of:
• The remote interface
• The server application
• The client application
• Both client and server interact with the remote interface. 12/23/2020 3
The Remote Interface

• The remote interface declares each of the methods that you want to call
remotely.
• Remote interface has the following characteristics:
• It extends the java.rmi.Remote interface.
• It declares the RemoteException.

12/23/2020 4
The Remote Interface

12/23/2020 5
The Server Application

• The server application provides the implementation of the remote interface.


• A "server" class is the class which has a main method that:
• Creates an instance of the remote object implementation (constructor):
• The constructor exports the remote object: Once created, the remote object is ready to accept incoming
remote method invocations by listening for incoming calls.
• Binds that instance to a name in the rmiregistry.
• The RMI registry is a simple server-side name server that allows remote clients to get a reference to a remote
object.
• The class must extend the UnicastRemoteObject class:
• When you extend java.rmi.server.UnicastRemoteObject, your class is automatically exported
12/23/2020 upon6
creation.
The Server Application

12/23/2020 7
The Client Application

• To “find” the server, the client uses an Interface object that “looks” for a
reference for the remote object associated with the name we pass as
parameter.
• It gets a reference to the remote object implementation from the server
host's rmiregistry.
• It invokes the remote method on the server's remote object.

12/23/2020 8
The Client Application

12/23/2020 9
Running the RMI Application

• Write the Java sources.


• Compile and deploy class files.
• Start the RMI registry, server, and client as shown in the output.

12/23/2020 10
Running the RMI Application

12/23/2020 11

You might also like