SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
RMI Architecture

Prof. Ashish Bhatia,ast.bhatia@gmail.com,ashish@asbspace.in,
              Web: asbspace.in, M:9879009551


                    September 10, 2012
OutLine
Basic of RMI
RMI Architecture
RMI Architecture
3 Common Terms
Stub
Skeleton
Remote Reference Layer
RMI Registry
Creating RMI Base Application
Creating the interface
Creating the interface
Implementing the interface
Creating the Server Program
Creating the Client Program
Running the Program
Basic of RMI




      Stands for Remote Method Procedure Call.
Basic of RMI




      Stands for Remote Method Procedure Call.
      Enables to communicate two different objects in different Java
      Virtual Machine.
Basic of RMI




      Stands for Remote Method Procedure Call.
      Enables to communicate two different objects in different Java
      Virtual Machine.
      Distributed Application Development and Remote Calling
Basic of RMI




      Stands for Remote Method Procedure Call.
      Enables to communicate two different objects in different Java
      Virtual Machine.
      Distributed Application Development and Remote Calling
      CORBA - Common Object Request Broker Architectire,
      DCOM - Distributed Component Object Model.
RMI Architecture
RMI Architecture



      Mechanism by which client can programmer make a regular
      method call , without worrying about sending data across the
      network or parsing the response.
      The solution is to install the proxy object on the client.
      Proxy is an object located at client VM that appears to be
      client program.
      Client call proxy, making a regular method call.
      Client proxy contacts server using a network protocol [TCP]
      Same happen at server side.
      Proxy on server so that server don’t realize the network call.
RMI Architecture




      Proxies at both the end communicated with each other and it
      shows / pretends that calls were regular calls not the remote
      call.
      How do Remote Call Works ?
          Java RMI
          CORBA [ IIOP ]
          Web Service [ SOAP ]
RMI Architecture
3 Common Terms



     Marshalling :is a process in which parameters passed by
     client are converted to a format that can be transferred across
     a network.
3 Common Terms



     Marshalling :is a process in which parameters passed by
     client are converted to a format that can be transferred across
     a network.
     UnMarshalling : is a process in which marshaled parameters
     passed by the client-side RRL through the server-side RRL are
     converted to a format that the skeleton understands.
3 Common Terms



     Marshalling :is a process in which parameters passed by
     client are converted to a format that can be transferred across
     a network.
     UnMarshalling : is a process in which marshaled parameters
     passed by the client-side RRL through the server-side RRL are
     converted to a format that the skeleton understands.
     Serilization : is a general purpose mechanism for taking an
     object and encoding it as a stream of bytes. The underlying
     design rationale is fairly simple.
Stub : Client Side Proxy



      Client invoke a method on a remote object -¿ Call to Proxy
      Object called STUB
      STUB knows how to contact to the server.
      It packages the parameters used in remote methods in to a
      block of bytes
      Process of Encoding is called Marshalling
      An identifier of the remote object to be used
      A description of the method to be called. The parameters.
      Objects are encoded using Serilaization
Skeleton : Server Side Proxy




      It locates remote object to be called
      It calls the desired method, passing the supplied parameters.
      It captures the return value or exception of the call.
      It sends a package consisting of the marshaled return data
      back to the stub on the client.
Remote Reference Layer




      Encapsulates the invocation semantic of the RMI connection.
      Provides java.rmi.server.RemoteRef object which handle
      remote service implmentation object.
      invoke() method is used by stub instance to forward method
      call.
      RRL extracts information about the remote server / remote
      client.
RMI Registry


      It is a naming services used by RMI server program to bind
      the Java Object with names.
      Client retrieves object using the name from the RMI registry.
      By default it runs on the port 1099 to accept the queries.
      On a host machine, a server program creates a remote service
      by first creating a local object that implements that service.
      RMI creates a listening service that waits for clients to
      connect and request the service.
      On the client side, the RMI Registry is accessed through the
      static class Naming. It provides the method lookup() that a
      client uses to query a registry.
Creating RMI Base Application




    1. Create the interface.
    2. Define a class that implements an interface.
    3. Create the server process.
    4. Create the client process.
Creating the interface




   import java.rmi.*;
   public interface Hello extends Remote
   {
     public String sayDemo() throws RemoteException;
   }
Creating the interface




   import java.rmi.*;
   public interface Hello extends Remote
   {
     public String sayDemo() throws RemoteException;
   }
Implementing the interface



   import java.rmi.*;
   import java.rmi.server.*;
   public class HelloImpl extends UnicastRemoteObject
   implements Hello
   {
     public String sayDemo() throws RemoteException
     {
       return("Hello World");
     }
   }
Creating the Server Program


   import java.rmi.*;
   import java.rmi.server.*;
   public class HelloServer
   {
     public static void main(String args)
     {
       HelloImpl temp = new HelloImpl();
       String rmiobjectname = "rmi://localhost/Hello";
       Context namingContext=new InitialContext();
       namingContext.bind(rmiobjectname,temp);
       System.out.println("Binding Complete ...");
     }
   }
Creating the Client Program
   import java.rmi.*;
   import java.rmi.server.*;
   public class HelloClient
   {
     public static void main(String args)
     {
       try
       {
         Context namingContext = new InitialContext();
         Hello greeting =
   (Hello)namingContext.lookup("rmi://localhost/Hello");
         System.out.println("Recvd Message ..." +
   greeting.getGreeting());
       }
       catch(ConnectException e)
       {
         System.out.println("Error");
Running the Program



      Compile all java files.
      Run rmic HelloImpl to generate Stub Files
      Create two folders Server anc Client
      Copy all class files except HelloClient.class and stub.class file
      in server folder
      Copy HelloClient.class, Hello.class and stub.class in client
      folder.
      Run rmiregistry through commandprompt.
      Run HelloServer followed by HelloClient.

Weitere ähnliche Inhalte

Was ist angesagt?

INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSINGAaqib Hussain
 
Common Object Request Broker Architecture - CORBA
Common Object Request Broker Architecture - CORBACommon Object Request Broker Architecture - CORBA
Common Object Request Broker Architecture - CORBAPeter R. Egli
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure callSunita Sahu
 
Computer Vision - Real Time Face Recognition using Open CV and Python
Computer Vision - Real Time Face Recognition using Open CV and PythonComputer Vision - Real Time Face Recognition using Open CV and Python
Computer Vision - Real Time Face Recognition using Open CV and PythonAkash Satamkar
 
IOT Platform Design Methodology
IOT Platform Design Methodology IOT Platform Design Methodology
IOT Platform Design Methodology poonam kumawat
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.pptVMahesh5
 
JDBC Architecture and Drivers
JDBC Architecture and DriversJDBC Architecture and Drivers
JDBC Architecture and DriversSimoniShah6
 
Advanced java
Advanced java Advanced java
Advanced java NA
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)Manisha Keim
 
Transport layer (computer networks)
Transport layer (computer networks)Transport layer (computer networks)
Transport layer (computer networks)Fatbardh Hysa
 

Was ist angesagt? (20)

Database System Architectures
Database System ArchitecturesDatabase System Architectures
Database System Architectures
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
 
Common Object Request Broker Architecture - CORBA
Common Object Request Broker Architecture - CORBACommon Object Request Broker Architecture - CORBA
Common Object Request Broker Architecture - CORBA
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
Computer Vision - Real Time Face Recognition using Open CV and Python
Computer Vision - Real Time Face Recognition using Open CV and PythonComputer Vision - Real Time Face Recognition using Open CV and Python
Computer Vision - Real Time Face Recognition using Open CV and Python
 
Recovery techniques
Recovery techniquesRecovery techniques
Recovery techniques
 
Image mining
Image miningImage mining
Image mining
 
Java rmi
Java rmiJava rmi
Java rmi
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
IOT Platform Design Methodology
IOT Platform Design Methodology IOT Platform Design Methodology
IOT Platform Design Methodology
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
JDBC Architecture and Drivers
JDBC Architecture and DriversJDBC Architecture and Drivers
JDBC Architecture and Drivers
 
Rmi ppt
Rmi pptRmi ppt
Rmi ppt
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Advanced java
Advanced java Advanced java
Advanced java
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Transport layer (computer networks)
Transport layer (computer networks)Transport layer (computer networks)
Transport layer (computer networks)
 
Java rmi
Java rmiJava rmi
Java rmi
 
Deadlock dbms
Deadlock dbmsDeadlock dbms
Deadlock dbms
 

Andere mochten auch

Remote method invocation
Remote method invocationRemote method invocation
Remote method invocationDew Shishir
 
Remote invocation
Remote invocationRemote invocation
Remote invocationishapadhy
 
Advanced java programming-contents
Advanced java programming-contentsAdvanced java programming-contents
Advanced java programming-contentsSelf-Employed
 
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
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionKelum Senanayake
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJBPeter R. Egli
 
Java - Remote method invocation
Java - Remote method invocationJava - Remote method invocation
Java - Remote method invocationRiccardo Cardin
 
Introduction to java beans
Introduction to java beansIntroduction to java beans
Introduction to java beansHitesh Parmar
 

Andere mochten auch (16)

Remote method invocation
Remote method invocationRemote method invocation
Remote method invocation
 
Remote invocation
Remote invocationRemote invocation
Remote invocation
 
Rmi ppt-2003
Rmi ppt-2003Rmi ppt-2003
Rmi ppt-2003
 
Advanced java programming-contents
Advanced java programming-contentsAdvanced java programming-contents
Advanced java programming-contents
 
CS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMSCS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMS
 
RMI
RMIRMI
RMI
 
Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)
 
EJB3 Basics
EJB3 BasicsEJB3 Basics
EJB3 Basics
 
Advance Java
Advance JavaAdvance Java
Advance Java
 
Javabeans
JavabeansJavabeans
Javabeans
 
Java beans
Java beansJava beans
Java beans
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJB
 
Java - Remote method invocation
Java - Remote method invocationJava - Remote method invocation
Java - Remote method invocation
 
Introduction to java beans
Introduction to java beansIntroduction to java beans
Introduction to java beans
 

Ähnlich wie Remote Method Invocation

Ähnlich wie Remote Method Invocation (20)

Remote method invocatiom
Remote method invocatiomRemote method invocatiom
Remote method invocatiom
 
RMI (Remote Method Invocation)
RMI (Remote Method Invocation)RMI (Remote Method Invocation)
RMI (Remote Method Invocation)
 
Rmi
RmiRmi
Rmi
 
Rmi
RmiRmi
Rmi
 
Rmi
RmiRmi
Rmi
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
DS
DSDS
DS
 
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
 
Distributed objects
Distributed objectsDistributed objects
Distributed objects
 
Rmi3
Rmi3Rmi3
Rmi3
 
Distributed Objects and JAVA
Distributed Objects and JAVADistributed Objects and JAVA
Distributed Objects and JAVA
 
remote method invocation
remote method invocationremote method invocation
remote method invocation
 
ADB Lab Manual.docx
ADB Lab Manual.docxADB Lab Manual.docx
ADB Lab Manual.docx
 
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 Invocation, Advanced programming
Remote Method Invocation, Advanced programmingRemote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programming
 
Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01
 
17rmi
17rmi17rmi
17rmi
 
Remote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVARemote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVA
 
Rmi
RmiRmi
Rmi
 

Mehr von ashishspace

I/O In Java Part 2
I/O In Java Part 2I/O In Java Part 2
I/O In Java Part 2ashishspace
 
I/O in java Part 1
I/O in java Part 1I/O in java Part 1
I/O in java Part 1ashishspace
 
Understanding Date Handling and Collection Framework
Understanding Date Handling and Collection FrameworkUnderstanding Date Handling and Collection Framework
Understanding Date Handling and Collection Frameworkashishspace
 
Nested and Enum in Java
Nested and Enum in JavaNested and Enum in Java
Nested and Enum in Javaashishspace
 
HTTP Basic and Servlet Basic
HTTP Basic and Servlet BasicHTTP Basic and Servlet Basic
HTTP Basic and Servlet Basicashishspace
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiersashishspace
 
Data types and operators and statements
Data types and operators and statementsData types and operators and statements
Data types and operators and statementsashishspace
 

Mehr von ashishspace (7)

I/O In Java Part 2
I/O In Java Part 2I/O In Java Part 2
I/O In Java Part 2
 
I/O in java Part 1
I/O in java Part 1I/O in java Part 1
I/O in java Part 1
 
Understanding Date Handling and Collection Framework
Understanding Date Handling and Collection FrameworkUnderstanding Date Handling and Collection Framework
Understanding Date Handling and Collection Framework
 
Nested and Enum in Java
Nested and Enum in JavaNested and Enum in Java
Nested and Enum in Java
 
HTTP Basic and Servlet Basic
HTTP Basic and Servlet BasicHTTP Basic and Servlet Basic
HTTP Basic and Servlet Basic
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiers
 
Data types and operators and statements
Data types and operators and statementsData types and operators and statements
Data types and operators and statements
 

Kürzlich hochgeladen

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 

Kürzlich hochgeladen (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 

Remote Method Invocation

  • 1. RMI Architecture Prof. Ashish Bhatia,ast.bhatia@gmail.com,ashish@asbspace.in, Web: asbspace.in, M:9879009551 September 10, 2012
  • 2. OutLine Basic of RMI RMI Architecture RMI Architecture 3 Common Terms Stub Skeleton Remote Reference Layer RMI Registry Creating RMI Base Application Creating the interface Creating the interface Implementing the interface Creating the Server Program Creating the Client Program Running the Program
  • 3. Basic of RMI Stands for Remote Method Procedure Call.
  • 4. Basic of RMI Stands for Remote Method Procedure Call. Enables to communicate two different objects in different Java Virtual Machine.
  • 5. Basic of RMI Stands for Remote Method Procedure Call. Enables to communicate two different objects in different Java Virtual Machine. Distributed Application Development and Remote Calling
  • 6. Basic of RMI Stands for Remote Method Procedure Call. Enables to communicate two different objects in different Java Virtual Machine. Distributed Application Development and Remote Calling CORBA - Common Object Request Broker Architectire, DCOM - Distributed Component Object Model.
  • 8. RMI Architecture Mechanism by which client can programmer make a regular method call , without worrying about sending data across the network or parsing the response. The solution is to install the proxy object on the client. Proxy is an object located at client VM that appears to be client program. Client call proxy, making a regular method call. Client proxy contacts server using a network protocol [TCP] Same happen at server side. Proxy on server so that server don’t realize the network call.
  • 9. RMI Architecture Proxies at both the end communicated with each other and it shows / pretends that calls were regular calls not the remote call. How do Remote Call Works ? Java RMI CORBA [ IIOP ] Web Service [ SOAP ]
  • 11. 3 Common Terms Marshalling :is a process in which parameters passed by client are converted to a format that can be transferred across a network.
  • 12. 3 Common Terms Marshalling :is a process in which parameters passed by client are converted to a format that can be transferred across a network. UnMarshalling : is a process in which marshaled parameters passed by the client-side RRL through the server-side RRL are converted to a format that the skeleton understands.
  • 13. 3 Common Terms Marshalling :is a process in which parameters passed by client are converted to a format that can be transferred across a network. UnMarshalling : is a process in which marshaled parameters passed by the client-side RRL through the server-side RRL are converted to a format that the skeleton understands. Serilization : is a general purpose mechanism for taking an object and encoding it as a stream of bytes. The underlying design rationale is fairly simple.
  • 14. Stub : Client Side Proxy Client invoke a method on a remote object -¿ Call to Proxy Object called STUB STUB knows how to contact to the server. It packages the parameters used in remote methods in to a block of bytes Process of Encoding is called Marshalling An identifier of the remote object to be used A description of the method to be called. The parameters. Objects are encoded using Serilaization
  • 15. Skeleton : Server Side Proxy It locates remote object to be called It calls the desired method, passing the supplied parameters. It captures the return value or exception of the call. It sends a package consisting of the marshaled return data back to the stub on the client.
  • 16. Remote Reference Layer Encapsulates the invocation semantic of the RMI connection. Provides java.rmi.server.RemoteRef object which handle remote service implmentation object. invoke() method is used by stub instance to forward method call. RRL extracts information about the remote server / remote client.
  • 17. RMI Registry It is a naming services used by RMI server program to bind the Java Object with names. Client retrieves object using the name from the RMI registry. By default it runs on the port 1099 to accept the queries. On a host machine, a server program creates a remote service by first creating a local object that implements that service. RMI creates a listening service that waits for clients to connect and request the service. On the client side, the RMI Registry is accessed through the static class Naming. It provides the method lookup() that a client uses to query a registry.
  • 18. Creating RMI Base Application 1. Create the interface. 2. Define a class that implements an interface. 3. Create the server process. 4. Create the client process.
  • 19. Creating the interface import java.rmi.*; public interface Hello extends Remote { public String sayDemo() throws RemoteException; }
  • 20. Creating the interface import java.rmi.*; public interface Hello extends Remote { public String sayDemo() throws RemoteException; }
  • 21. Implementing the interface import java.rmi.*; import java.rmi.server.*; public class HelloImpl extends UnicastRemoteObject implements Hello { public String sayDemo() throws RemoteException { return("Hello World"); } }
  • 22. Creating the Server Program import java.rmi.*; import java.rmi.server.*; public class HelloServer { public static void main(String args) { HelloImpl temp = new HelloImpl(); String rmiobjectname = "rmi://localhost/Hello"; Context namingContext=new InitialContext(); namingContext.bind(rmiobjectname,temp); System.out.println("Binding Complete ..."); } }
  • 23. Creating the Client Program import java.rmi.*; import java.rmi.server.*; public class HelloClient { public static void main(String args) { try { Context namingContext = new InitialContext(); Hello greeting = (Hello)namingContext.lookup("rmi://localhost/Hello"); System.out.println("Recvd Message ..." + greeting.getGreeting()); } catch(ConnectException e) { System.out.println("Error");
  • 24. Running the Program Compile all java files. Run rmic HelloImpl to generate Stub Files Create two folders Server anc Client Copy all class files except HelloClient.class and stub.class file in server folder Copy HelloClient.class, Hello.class and stub.class in client folder. Run rmiregistry through commandprompt. Run HelloServer followed by HelloClient.