SlideShare a Scribd company logo
GROUP MEMBERS
MD. SHAHRIAR ANWAR (09.02.04.088)
NASHIYED ARAFUL HAQUE (09.02.04.078)
Remote Method Invocation
(RMI)
Overview
 Introduction of RMI
 Uses of RMI
 Interfaces and Classes
 RMI Architecture
 RMI Application Overview
 Remote Object and Interface Explained
 A short demonstration of RMI application
What is RMI?
 Remote Method Invocation (RMI), allows one host
to run programs on another host that is running a
program on a remote host from a local machine.
In Brief:
 It’s a core JAVA API
 Enables programs calling methods in objects
running on different host even though both
program exists in two physically different hosts.
Why We Need RMI?
Let’s think a scenario -
 Suppose you’re an owner of a large company. You’re
company have branches all over the country.
 Now if one of your company branch need to get
services/data from head office, how they’ll do it?
Answer is : RMI
We’ll show you how that work and what it does
Interface and Classes in Package java.rmi
RemoteObject
RemoteServer
Activatable UnicastRemoteobject
Remote
Interface Classes
RMI Architecture
 The server must first bind its name to
the registry
 The client lookup the server name in
the registry to establish remote
references.
 The Stub serializing the parameters to
skeleton, the skeleton invoking the
remote method and serializing the
result back to the stub.
The Stubs and Skeleton
RMI Client Stubs Skeleton RMI Server
Call
Return
 A client invokes a remote method, the call is first forwarded to stub.
 The stub is responsible for sending the remote call over to the
serverside skeleton
 The stub opening a socket to the remote server, marshaling the object
parameters and forwarding the data stream to the skeleton.
 A skeleton contains a method that receives the remote calls, unmarshals
the parameters, and invokes the actual remote object implementation.
RMI Application Overview
 RMI applications consist of two separate programs, a
server and a client.
 Server program creates some remote objects, makes
references to these objects accessible, and waits for
clients to invoke methods on these objects.
 Client program obtains a remote reference to one or
more remote objects on a server and then invokes
methods on them.
Remote Object
 An object with methods that may be invoked from
a different Java virtual machine than the one
running on a different computer.
 Each remote object implements one or more
remote interfaces that declare which methods of
the remote object can be invoked by the foreign
system.
Remote interfaces, Objects and Methods
Remote Object
 Objects with methods that can be invoked across
Java virtual machines are called remote objects
 Remote Object implements Remote Interface
 A Remote Interface extends java.rmi.Remote
interface
 Each method of the interface declares
java.rmi.RemoteException in its throws clause
Remote Interface Explained
 Let’s take a sample code snippet
import java.rmi.*;
public interface HomeWork extends Remote {
public String giveMeYourHomeWork( ) throws RemoteException;
}
Remote Interface Explained (cont…)
 Java program running on your workstation (e.g. JVM on
you.com) could look up the current HomeWork object in the
RMI registry at remote virtual machine (e.g. JVM on
yourfriend.com).
 The registry would send it a reference to the object running in
remote (yourfriend.com 's) virtual machine.
 Your program could then use this reference to invoke the
giveMeYourHomeWork( ) method.
 The giveMeYourHomeWork( ) method would execute on the
server in remote machine not on your local machine.
However, it would return the String value back to your local
program running in your local machine.
A Short RMI Example
 What this program does?
 This is a simple program which pass two integers to Server
through RMI and invoke remote method from Client to
calculate their Sum.
 There are 3 classes and 1 interface
 SumInterface
 SumImpl
 RMIServer
 RMIClient
SumInterface.java
SumImpl.java
RMIServer.java
RMIClient.java
Compiling and Running from Terminal
Compiling …
After compiling following classes are generated …
Generating Stubs and Starting RMI Registry
Generating Stubs and Starting RMI Registry …
After generating Stubs directory looks like …
Starting Server and Client
Open a new Terminal and start the server …
Open another new Terminal and start the Client … (You’ll get result immediately)
References
 http://www.javacoffeebreak.com/articles/javarmi/ja
varmi.html
 http://docs.oracle.com/javase/7/docs/platform/rmi
/spec/rmi-arch2.html
 http://en.wikipedia.org/wiki/Java_remote_method
_invocation
 http://docs.oracle.com/javase/7/docs/api/java/rmi/
package-summary.html
Remote method invocation

More Related Content

PPT
PPT
Remote Method Invocation
PDF
Remote Method Invocation
PPT
A Short Java RMI Tutorial
PPT
PPSX
Java rmi
PDF
Java rmi
PDF
Rmi ppt-2003
Remote Method Invocation
Remote Method Invocation
A Short Java RMI Tutorial
Java rmi
Java rmi
Rmi ppt-2003

What's hot (20)

PPTX
Java RMI(Remote Method Invocation)
PPT
Distributed Programming using RMI
PPTX
Remote Method Invocation (Java RMI)
PDF
Remote Method Invocation in JAVA
PPTX
Remote Method Innovation (RMI) In JAVA
PPS
Java rmi
PPTX
PPTX
PDF
Java RMI Detailed Tutorial
PPTX
Java RMI
PPTX
Rmi presentation
PPTX
Introduction To Rmi
PPTX
Java RMI Presentation
PDF
Remote Method Invocation (RMI)
PPT
Java remote method invocation
PPTX
Rmi architecture
PPTX
Java RMI
PDF
Java rmi tutorial
PPTX
Remote Method Invocation
Java RMI(Remote Method Invocation)
Distributed Programming using RMI
Remote Method Invocation (Java RMI)
Remote Method Invocation in JAVA
Remote Method Innovation (RMI) In JAVA
Java rmi
Java RMI Detailed Tutorial
Java RMI
Rmi presentation
Introduction To Rmi
Java RMI Presentation
Remote Method Invocation (RMI)
Java remote method invocation
Rmi architecture
Java RMI
Java rmi tutorial
Remote Method Invocation
Ad

Viewers also liked (18)

PPTX
Java - Remote method invocation
PDF
Introduction to Remote Method Invocation (RMI)
PPS
Java rmi example program with code
PPT
Remote invocation
PDF
Remote method invocation (as part of the the PTT lecture)
PDF
Remote Method Invocation
PPTX
IPC SOCKET
PPTX
Inter-Process communication using pipe in FPGA based adaptive communication
PPTX
Introduction to C++ Remote Procedure Call (RPC)
PDF
CS6601 DISTRIBUTED SYSTEMS
PPTX
RPC: Remote procedure call
PDF
Overview of big data in cloud computing
PPT
Socket System Calls
PPT
Chapter 4 a interprocess communication
PDF
Network Sockets
PPT
remote procedure calls
PDF
Piping Training course-How to be an Expert in Pipe & Fittings for Oil & Gas c...
PDF
Designing Teams for Emerging Challenges
Java - Remote method invocation
Introduction to Remote Method Invocation (RMI)
Java rmi example program with code
Remote invocation
Remote method invocation (as part of the the PTT lecture)
Remote Method Invocation
IPC SOCKET
Inter-Process communication using pipe in FPGA based adaptive communication
Introduction to C++ Remote Procedure Call (RPC)
CS6601 DISTRIBUTED SYSTEMS
RPC: Remote procedure call
Overview of big data in cloud computing
Socket System Calls
Chapter 4 a interprocess communication
Network Sockets
remote procedure calls
Piping Training course-How to be an Expert in Pipe & Fittings for Oil & Gas c...
Designing Teams for Emerging Challenges
Ad

Similar to Remote method invocation (20)

DOCX
Remote Method Invocation
PPTX
Remote method invocation
PDF
Module 3 remote method invocation-2
PDF
Distributed Programming (RMI)
DOCX
remote method invocation
PDF
Remote Method Invocation, Advanced programming
PPTX
Basic java
PDF
DOCX
ADB Lab Manual.docx
PDF
17rmi
PPTX
PDF
RMI (Remote Method Invocation)
PPTX
Remote method invocatiom
DOCX
Report on mini project(Student database handling using RMI)
PPT
PPT
Distributed Objects and JAVA
DOCX
Java rmi
Remote Method Invocation
Remote method invocation
Module 3 remote method invocation-2
Distributed Programming (RMI)
remote method invocation
Remote Method Invocation, Advanced programming
Basic java
ADB Lab Manual.docx
17rmi
RMI (Remote Method Invocation)
Remote method invocatiom
Report on mini project(Student database handling using RMI)
Distributed Objects and JAVA
Java rmi

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
A Presentation on Touch Screen Technology
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Hybrid model detection and classification of lung cancer
PPTX
A Presentation on Artificial Intelligence
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Mushroom cultivation and it's methods.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Encapsulation theory and applications.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
August Patch Tuesday
Unlocking AI with Model Context Protocol (MCP)
MIND Revenue Release Quarter 2 2025 Press Release
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Zenith AI: Advanced Artificial Intelligence
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
A Presentation on Touch Screen Technology
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
A comparative study of natural language inference in Swahili using monolingua...
Hybrid model detection and classification of lung cancer
A Presentation on Artificial Intelligence
1 - Historical Antecedents, Social Consideration.pdf
Mushroom cultivation and it's methods.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Encapsulation theory and applications.pdf
Assigned Numbers - 2025 - Bluetooth® Document
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Hindi spoken digit analysis for native and non-native speakers
August Patch Tuesday

Remote method invocation

  • 1. GROUP MEMBERS MD. SHAHRIAR ANWAR (09.02.04.088) NASHIYED ARAFUL HAQUE (09.02.04.078) Remote Method Invocation (RMI)
  • 2. Overview  Introduction of RMI  Uses of RMI  Interfaces and Classes  RMI Architecture  RMI Application Overview  Remote Object and Interface Explained  A short demonstration of RMI application
  • 3. What is RMI?  Remote Method Invocation (RMI), allows one host to run programs on another host that is running a program on a remote host from a local machine. In Brief:  It’s a core JAVA API  Enables programs calling methods in objects running on different host even though both program exists in two physically different hosts.
  • 4. Why We Need RMI? Let’s think a scenario -  Suppose you’re an owner of a large company. You’re company have branches all over the country.  Now if one of your company branch need to get services/data from head office, how they’ll do it? Answer is : RMI We’ll show you how that work and what it does
  • 5. Interface and Classes in Package java.rmi RemoteObject RemoteServer Activatable UnicastRemoteobject Remote Interface Classes
  • 6. RMI Architecture  The server must first bind its name to the registry  The client lookup the server name in the registry to establish remote references.  The Stub serializing the parameters to skeleton, the skeleton invoking the remote method and serializing the result back to the stub.
  • 7. The Stubs and Skeleton RMI Client Stubs Skeleton RMI Server Call Return  A client invokes a remote method, the call is first forwarded to stub.  The stub is responsible for sending the remote call over to the serverside skeleton  The stub opening a socket to the remote server, marshaling the object parameters and forwarding the data stream to the skeleton.  A skeleton contains a method that receives the remote calls, unmarshals the parameters, and invokes the actual remote object implementation.
  • 8. RMI Application Overview  RMI applications consist of two separate programs, a server and a client.  Server program creates some remote objects, makes references to these objects accessible, and waits for clients to invoke methods on these objects.  Client program obtains a remote reference to one or more remote objects on a server and then invokes methods on them.
  • 9. Remote Object  An object with methods that may be invoked from a different Java virtual machine than the one running on a different computer.  Each remote object implements one or more remote interfaces that declare which methods of the remote object can be invoked by the foreign system.
  • 10. Remote interfaces, Objects and Methods Remote Object  Objects with methods that can be invoked across Java virtual machines are called remote objects  Remote Object implements Remote Interface  A Remote Interface extends java.rmi.Remote interface  Each method of the interface declares java.rmi.RemoteException in its throws clause
  • 11. Remote Interface Explained  Let’s take a sample code snippet import java.rmi.*; public interface HomeWork extends Remote { public String giveMeYourHomeWork( ) throws RemoteException; }
  • 12. Remote Interface Explained (cont…)  Java program running on your workstation (e.g. JVM on you.com) could look up the current HomeWork object in the RMI registry at remote virtual machine (e.g. JVM on yourfriend.com).  The registry would send it a reference to the object running in remote (yourfriend.com 's) virtual machine.  Your program could then use this reference to invoke the giveMeYourHomeWork( ) method.  The giveMeYourHomeWork( ) method would execute on the server in remote machine not on your local machine. However, it would return the String value back to your local program running in your local machine.
  • 13. A Short RMI Example  What this program does?  This is a simple program which pass two integers to Server through RMI and invoke remote method from Client to calculate their Sum.  There are 3 classes and 1 interface  SumInterface  SumImpl  RMIServer  RMIClient
  • 18. Compiling and Running from Terminal Compiling … After compiling following classes are generated …
  • 19. Generating Stubs and Starting RMI Registry Generating Stubs and Starting RMI Registry … After generating Stubs directory looks like …
  • 20. Starting Server and Client Open a new Terminal and start the server … Open another new Terminal and start the Client … (You’ll get result immediately)
  • 21. References  http://www.javacoffeebreak.com/articles/javarmi/ja varmi.html  http://docs.oracle.com/javase/7/docs/platform/rmi /spec/rmi-arch2.html  http://en.wikipedia.org/wiki/Java_remote_method _invocation  http://docs.oracle.com/javase/7/docs/api/java/rmi/ package-summary.html

Editor's Notes

  • #13: Slide dekhebolleihobe