SlideShare una empresa de Scribd logo
1 de 22
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

Más contenido relacionado

La actualidad más candente

Java RMI(Remote Method Invocation)
Java RMI(Remote Method Invocation)Java RMI(Remote Method Invocation)
Java RMI(Remote Method Invocation)Nilesh Valva
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMIbackdoor
 
Remote Method Invocation (Java RMI)
Remote Method Invocation (Java RMI)Remote Method Invocation (Java RMI)
Remote Method Invocation (Java RMI)Sonali Parab
 
Remote Method Invocation in JAVA
Remote Method Invocation in JAVARemote Method Invocation in JAVA
Remote Method Invocation in JAVAJalpesh Vasa
 
Remote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVARemote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVAPrankit Mishra
 
Java RMI Detailed Tutorial
Java RMI Detailed TutorialJava RMI Detailed Tutorial
Java RMI Detailed TutorialMasud Rahman
 
Java RMI Presentation
Java RMI PresentationJava RMI Presentation
Java RMI PresentationMasud Rahman
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Peter R. Egli
 
Java remote method invocation
Java remote method invocationJava remote method invocation
Java remote method invocationVan Dawn
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method InvocationSabiha M
 

La actualidad más candente (20)

Java RMI(Remote Method Invocation)
Java RMI(Remote Method Invocation)Java RMI(Remote Method Invocation)
Java RMI(Remote Method Invocation)
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMI
 
Remote Method Invocation (Java RMI)
Remote Method Invocation (Java RMI)Remote Method Invocation (Java RMI)
Remote Method Invocation (Java RMI)
 
Remote Method Invocation in JAVA
Remote Method Invocation in JAVARemote Method Invocation in JAVA
Remote Method Invocation in JAVA
 
Remote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVARemote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVA
 
Java rmi
Java rmiJava rmi
Java rmi
 
Rmi
RmiRmi
Rmi
 
Rmi
RmiRmi
Rmi
 
Java RMI Detailed Tutorial
Java RMI Detailed TutorialJava RMI Detailed Tutorial
Java RMI Detailed Tutorial
 
Rmi ppt
Rmi pptRmi ppt
Rmi ppt
 
Java RMI
Java RMIJava RMI
Java RMI
 
Rmi presentation
Rmi presentationRmi presentation
Rmi presentation
 
Introduction To Rmi
Introduction To RmiIntroduction To Rmi
Introduction To Rmi
 
Java RMI Presentation
Java RMI PresentationJava RMI Presentation
Java RMI Presentation
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
 
Java remote method invocation
Java remote method invocationJava remote method invocation
Java remote method invocation
 
Rmi architecture
Rmi architectureRmi architecture
Rmi architecture
 
Java RMI
Java RMIJava RMI
Java RMI
 
Java rmi tutorial
Java rmi tutorialJava rmi tutorial
Java rmi tutorial
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 

Destacado

Java - Remote method invocation
Java - Remote method invocationJava - Remote method invocation
Java - Remote method invocationRiccardo Cardin
 
Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)eLink Business Innovations
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with codekamal kotecha
 
Remote invocation
Remote invocationRemote invocation
Remote invocationishapadhy
 
Remote method invocation (as part of the the PTT lecture)
Remote method invocation (as part of the the PTT lecture)Remote method invocation (as part of the the PTT lecture)
Remote method invocation (as part of the the PTT lecture)Ralf Laemmel
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocationelliando dias
 
Inter-Process communication using pipe in FPGA based adaptive communication
Inter-Process communication using pipe in FPGA based adaptive communicationInter-Process communication using pipe in FPGA based adaptive communication
Inter-Process communication using pipe in FPGA based adaptive communicationMayur Shah
 
Introduction to C++ Remote Procedure Call (RPC)
Introduction to C++ Remote Procedure Call (RPC)Introduction to C++ Remote Procedure Call (RPC)
Introduction to C++ Remote Procedure Call (RPC)Abdelrahman Al-Ogail
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure callSunita Sahu
 
Overview of big data in cloud computing
Overview of big data in cloud computingOverview of big data in cloud computing
Overview of big data in cloud computingViet-Trung TRAN
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communicationAbDul ThaYyal
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure callsAshish Kumar
 
Piping Training course-How to be an Expert in Pipe & Fittings for Oil & Gas c...
Piping Training course-How to be an Expert in Pipe & Fittings for Oil & Gas c...Piping Training course-How to be an Expert in Pipe & Fittings for Oil & Gas c...
Piping Training course-How to be an Expert in Pipe & Fittings for Oil & Gas c...Varun Patel
 
Designing Teams for Emerging Challenges
Designing Teams for Emerging ChallengesDesigning Teams for Emerging Challenges
Designing Teams for Emerging ChallengesAaron Irizarry
 

Destacado (18)

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

Similar a Remote method invocation

Similar a Remote method invocation (20)

Oracle docs rmi applications
Oracle docs rmi applicationsOracle docs rmi applications
Oracle docs rmi applications
 
Rmi
RmiRmi
Rmi
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
RMI (Remote Method Invocation)
RMI (Remote Method Invocation)RMI (Remote Method Invocation)
RMI (Remote Method Invocation)
 
Basic java
Basic java Basic java
Basic java
 
Rmi
RmiRmi
Rmi
 
Remote method invocation
Remote method invocationRemote method invocation
Remote method invocation
 
Remote method invocatiom
Remote method invocatiomRemote method invocatiom
Remote method invocatiom
 
Distributed objects
Distributed objectsDistributed objects
Distributed objects
 
Remote method invocation
Remote method invocationRemote method invocation
Remote method invocation
 
Module 3 remote method invocation-2
Module 3   remote method  invocation-2Module 3   remote method  invocation-2
Module 3 remote method invocation-2
 
Java interview questions for freshers
Java interview questions for freshersJava interview questions for freshers
Java interview questions for freshers
 
Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01
 
Rmi3
Rmi3Rmi3
Rmi3
 
ADB Lab Manual.docx
ADB Lab Manual.docxADB Lab Manual.docx
ADB Lab Manual.docx
 
remote method invocation
remote method invocationremote method invocation
remote method invocation
 
Distributed Programming using RMI
 Distributed Programming using RMI Distributed Programming using RMI
Distributed Programming using RMI
 
Remote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programmingRemote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programming
 
#4 (Remote Method Invocation)
#4 (Remote Method Invocation)#4 (Remote Method Invocation)
#4 (Remote Method Invocation)
 
DS
DSDS
DS
 

Último

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

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

Notas del editor

  1. Slide dekhebolleihobe