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

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Java RMI
Java RMIJava RMI
Java RMI
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMI
 
Remote Method Invocation in JAVA
Remote Method Invocation in JAVARemote Method Invocation in JAVA
Remote Method Invocation in JAVA
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
 
Rmi ppt
Rmi pptRmi ppt
Rmi ppt
 
Mobile computing unit 5
Mobile computing  unit 5Mobile computing  unit 5
Mobile computing unit 5
 
Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
 
Files in java
Files in javaFiles in java
Files in java
 
Remote procedure call on client server computing
Remote procedure call on client server computingRemote procedure call on client server computing
Remote procedure call on client server computing
 
Distributed objects
Distributed objectsDistributed objects
Distributed objects
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJB
 
Stream oriented communication
Stream oriented communicationStream oriented communication
Stream oriented communication
 
Naming in Distributed System
Naming in Distributed SystemNaming in Distributed System
Naming in Distributed System
 
Java RMI
Java RMIJava RMI
Java RMI
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed System
 
Servlets
ServletsServlets
Servlets
 
Ds objects and models
Ds objects and modelsDs objects and models
Ds objects and models
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
Corba
CorbaCorba
Corba
 

Semelhante a RMI (20)

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
 
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
 
Introduction To Rmi
Introduction To RmiIntroduction To Rmi
Introduction To Rmi
 
javarmi
javarmijavarmi
javarmi
 
RMI (Remote Method Invocation)
RMI (Remote Method Invocation)RMI (Remote Method Invocation)
RMI (Remote Method Invocation)
 
Java RMI(Remote Method Invocation)
Java RMI(Remote Method Invocation)Java RMI(Remote Method Invocation)
Java RMI(Remote Method Invocation)
 

Último

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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...
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

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