SlideShare une entreprise Scribd logo
1  sur  14
Remote Method Invocation (RMI)

          Session 11




                       Master Java - Level 2/ Session 11 / 1 of 14
Session Objectives
   Describe the Java Distributed Model

   Analyse RMI Architeture

   Discuss RMI packages

   Explain how to implement RMI
    client and server
                              Master Java - Level 2/ Session 11/ 2 of 14
Distributed Application
   A Distributed application is an application whose
    processing is distributed across multiple networked
    computers.

   The various models that can be used for developing
    distributed applications
     Distributed Component Object Model(DCOM)
     Common Object Request Broker Architecture(CORBA)

     Remote Method Invocation(RMI)




                                    Master Java - Level 2/ Session 11/ 3 of 14
Remote Method Invocation (RMI)
The distributed object model used by Java allows objects
in one JVM to invoke methods of objects in a separate
JVM. This is known as RMI.

  Java Virtual Machine         Java Virtual Machine


       Client Object     TCP   Server Object




                                   Master Java - Level 2/ Session 11/ 4 of 14
RMI System Layers
   The RMI system consists of three layers in its
    architecture:

       Stub/Skeleton Layer

       Remote Reference Layer

       Transport Layer



                                    Master Java - Level 2/ Session 11/ 5 of 14
RMI Architecture
Java Virtual Machine         Java Virtual Machine

   Client Object               Server Object ‘S’


  Object ‘S’ Stub            Object ‘S’ Skeleton


 Remote Reference             Remote Reference
      Layer                        Layer
  TransportLayer       TCP       TransportLayer

                              Master Java - Level 2/ Session 11/ 6 of 14
Remote Method Invocation API
   The five packages in RMI API are:
           java.rmi
           java.rmi.registry
           java.rmi.server
          java.rmi.activation
          java.rmi.dgc


We shall be examining the first three in detail

                                  Master Java - Level 2/ Session 11/ 7 of 14
The java.rmi Package
   The java.rmi package declares
       The Remote interface

       The MarshalledObject class

       The Naming class

       The RMISecurityManager class

       A number of exceptions that are used with remote
        method invocations
                                         Master Java - Level 2/ Session 11/ 8 of 14
The java.rmi.registry Package
   The interfaces and class of the java.rmi.registry
    package are used to handle remote objects by
    name and also to register those remote objects

   The java.rmi.registry package provides

       The Registry interface

       The RegistryHandler interface

       The LocateRegistry class.       Master Java - Level 2/ Session 11/ 9 of 14
The java.rmi.server Package
   The java.rmi.server package supports both client and
    server aspects of RMI like a class implementation of
    Remote interface, client stub and server skeleton
   Classes and Interfaces declared are :

       RemoteObject class             Skeleton interface

       RemoteServer class             RMIClassLoader class

       UnicastRemoteObject class      RMISocketFactory class

       RemoteStub class
                                          Master Java - Level 2/ Session 11/ 10 of 14
Implementing RMI
   Implement RMI server
     Create Remote Interface
     Create a class that implements the remote interface

     Create stub and skeleton classes

     Copy Remote interface and stub to client

     Create and register remote objcet



   Implement the RMI client
       Call the remote interface by using the ‘lookup()’
        method of the Naming class.


                                          Master Java - Level 2/ Session 11/ 11 of 14
RMI flow - I

Client Virtual Machine          Server Virtual Machine

     Client                                 Remote Object                         1


                 Stub            Skeleton                   Server


1. Server Creates Remote      Registry Virtual Machine
                                                                                  2
   object.
                                   Remote Object
2. Server Registers Remote          Registered
   object with RMI registry
                                    Master Java - Level 2/ Session 11/ 12 of 14
RMI flow - II

    Client Virtual Machine      Server Virtual Machine

        Client                               Remote Object


                  Stub            Skeleton                 Server

                        4
3
                               3. Client requests object from
    Registry Virtual Machine
                                 registry

        Remote Object          4. Registry returns remote
         Registered               reference through interface
                                     Master Java - Level 2/ Session 11/ 13 of 14
RMI flow - III

Client Virtual Machine             Server Virtual Machine
                                     7
    Client                                 Remote Object

        5                  6                             Server
              Stub                  Skeleton


                               5. Client invokes stub method
Registry Virtual Machine
                               6. Stub talks to skeleton
    Remote Object
     Registered                7. Skeleton invokes remote
                                   object method.2/ Session 11/ 14 of 14
                                       Master Java - Level

Contenu connexe

Tendances (20)

Remote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVARemote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVA
 
Remote invocation
Remote invocationRemote invocation
Remote invocation
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
enterprise java bean
enterprise java beanenterprise java bean
enterprise java bean
 
JNDI
JNDIJNDI
JNDI
 
Java RMI
Java RMIJava RMI
Java RMI
 
Session bean
Session beanSession bean
Session bean
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Rmi ppt
Rmi pptRmi ppt
Rmi ppt
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJB
 
Java Socket Programming
Java Socket ProgrammingJava Socket Programming
Java Socket Programming
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
 
Java socket programming
Java socket programmingJava socket programming
Java socket programming
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed System
 
Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design Pattern
 
Remote Method Invocation in JAVA
Remote Method Invocation in JAVARemote Method Invocation in JAVA
Remote Method Invocation in JAVA
 
Rmi presentation
Rmi presentationRmi presentation
Rmi presentation
 
4. system models
4. system models4. system models
4. system models
 

Similaire à RMI

Similaire à RMI (20)

Distributed objects
Distributed objectsDistributed objects
Distributed objects
 
Rmi ppt-2003
Rmi ppt-2003Rmi ppt-2003
Rmi ppt-2003
 
Rmi
RmiRmi
Rmi
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
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
 
Remote method invocatiom
Remote method invocatiomRemote method invocatiom
Remote method invocatiom
 
Remote method invocation
Remote method invocationRemote method invocation
Remote method invocation
 
Remote method invocation
Remote method invocationRemote method invocation
Remote method invocation
 
Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01
 
Java rmi
Java rmiJava rmi
Java rmi
 
Rmi
RmiRmi
Rmi
 
Java rmi tutorial
Java rmi tutorialJava rmi tutorial
Java rmi tutorial
 
Remote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programmingRemote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programming
 
ADB Lab Manual.docx
ADB Lab Manual.docxADB Lab Manual.docx
ADB Lab Manual.docx
 
A Short Java RMI Tutorial
A Short Java RMI TutorialA Short Java RMI Tutorial
A Short Java RMI Tutorial
 
Rmi
RmiRmi
Rmi
 
Distributed Programming using RMI
 Distributed Programming using RMI Distributed Programming using RMI
Distributed Programming using RMI
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMI
 
Introduction To Rmi
Introduction To RmiIntroduction To Rmi
Introduction To Rmi
 

Dernier

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 

Dernier (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 

RMI

  • 1. Remote Method Invocation (RMI) Session 11 Master Java - Level 2/ Session 11 / 1 of 14
  • 2. Session Objectives  Describe the Java Distributed Model  Analyse RMI Architeture  Discuss RMI packages  Explain how to implement RMI client and server Master Java - Level 2/ Session 11/ 2 of 14
  • 3. Distributed Application  A Distributed application is an application whose processing is distributed across multiple networked computers.  The various models that can be used for developing distributed applications  Distributed Component Object Model(DCOM)  Common Object Request Broker Architecture(CORBA)  Remote Method Invocation(RMI) Master Java - Level 2/ Session 11/ 3 of 14
  • 4. Remote Method Invocation (RMI) The distributed object model used by Java allows objects in one JVM to invoke methods of objects in a separate JVM. This is known as RMI. Java Virtual Machine Java Virtual Machine Client Object TCP Server Object Master Java - Level 2/ Session 11/ 4 of 14
  • 5. RMI System Layers  The RMI system consists of three layers in its architecture:  Stub/Skeleton Layer  Remote Reference Layer  Transport Layer Master Java - Level 2/ Session 11/ 5 of 14
  • 6. RMI Architecture Java Virtual Machine Java Virtual Machine Client Object Server Object ‘S’ Object ‘S’ Stub Object ‘S’ Skeleton Remote Reference Remote Reference Layer Layer TransportLayer TCP TransportLayer Master Java - Level 2/ Session 11/ 6 of 14
  • 7. Remote Method Invocation API  The five packages in RMI API are:  java.rmi  java.rmi.registry  java.rmi.server  java.rmi.activation  java.rmi.dgc We shall be examining the first three in detail Master Java - Level 2/ Session 11/ 7 of 14
  • 8. The java.rmi Package  The java.rmi package declares  The Remote interface  The MarshalledObject class  The Naming class  The RMISecurityManager class  A number of exceptions that are used with remote method invocations Master Java - Level 2/ Session 11/ 8 of 14
  • 9. The java.rmi.registry Package  The interfaces and class of the java.rmi.registry package are used to handle remote objects by name and also to register those remote objects  The java.rmi.registry package provides  The Registry interface  The RegistryHandler interface  The LocateRegistry class. Master Java - Level 2/ Session 11/ 9 of 14
  • 10. The java.rmi.server Package  The java.rmi.server package supports both client and server aspects of RMI like a class implementation of Remote interface, client stub and server skeleton  Classes and Interfaces declared are :  RemoteObject class  Skeleton interface  RemoteServer class  RMIClassLoader class  UnicastRemoteObject class  RMISocketFactory class  RemoteStub class Master Java - Level 2/ Session 11/ 10 of 14
  • 11. Implementing RMI  Implement RMI server  Create Remote Interface  Create a class that implements the remote interface  Create stub and skeleton classes  Copy Remote interface and stub to client  Create and register remote objcet  Implement the RMI client  Call the remote interface by using the ‘lookup()’ method of the Naming class. Master Java - Level 2/ Session 11/ 11 of 14
  • 12. RMI flow - I Client Virtual Machine Server Virtual Machine Client Remote Object 1 Stub Skeleton Server 1. Server Creates Remote Registry Virtual Machine 2 object. Remote Object 2. Server Registers Remote Registered object with RMI registry Master Java - Level 2/ Session 11/ 12 of 14
  • 13. RMI flow - II Client Virtual Machine Server Virtual Machine Client Remote Object Stub Skeleton Server 4 3 3. Client requests object from Registry Virtual Machine registry Remote Object 4. Registry returns remote Registered reference through interface Master Java - Level 2/ Session 11/ 13 of 14
  • 14. RMI flow - III Client Virtual Machine Server Virtual Machine 7 Client Remote Object 5 6 Server Stub Skeleton 5. Client invokes stub method Registry Virtual Machine 6. Stub talks to skeleton Remote Object Registered 7. Skeleton invokes remote object method.2/ Session 11/ 14 of 14 Master Java - Level