SlideShare a Scribd company logo
JAVA REMOTE METHOD INVOCATION
(RMI)
Mohammad Masudur Rahman
mor543@mail.usask.ca
Department of Computer Science
University of Saskatchewan
Saskatoon, SK, S7N5C9
Date: April 09, 2013
2
TUTORIAL CONTENTS
Java Remote Method Invocation
 Historical Background
 Related Terminologies
 RMI System Architecture




Layered Structures
 Working Principles


A Simple RMI Application


Server, Client, Interface, Stubs
 Security, Deployment, Invocation

Strength & Weakness of RMI
 RMI vs. CORBA Case Study


3
JAVA REMOTE METHOD INVOCATION

Fig: Distributed Object Technology

4
JAVA REMOTE METHOD INVOCATION
RMI Server, client, interface, stubs, skeletons
 RMI Registry
 Object version of RPC
 Method Invocation between JVMs
 Java RMI API
 JRMP (Java Remote Method Protocol)
 Java object serialization
 Parameter Marshalling


5
HISTORICAL BACKGROUND
Abstraction: Low
level

Java
Sockets
by SUN

Abstraction:
Procedure level

Java RPC
by SUN
Abstraction:
Object level

CORBA
by OMG

Java RMI
by SUN

SOAP by
Microsoft
6
RELATED TERMINOLOGIES
RPC (Remote Procedure Call)
 XDR (External Data Representation)
 CORBA (Common Object Request Broker
Architecture)
 IIOP (Internet Inter-ORB Protocol)
 Java IDL (Interface Definition Language)
 RMI-IIOP
 SOAP (Simple Object Access Protocol)


7
RMI SYSTEM ARCHITECTURE
Lets divide into two perspectives:
 Layered Structure
 Working Principles

8
RMI LAYERED STRUCTURE

Fig: RMI Layered Structure

9
RMI LAYERED STRUCTURE
Application layer: Server, Client
 Interface: Client stub, Server skeleton
 Remote Reference layer: RMI registry
 Transport layer: HTTP


10
RMI WORKING PRINCIPLES

Fig: RMI Working principles

11
READY TO DEVELOP ONE?

12
A SIMPLE RMI APPLICATION

1

SERVER
oWriting an Interface
o Implementing an
Interface
o Binding Interface

CLIENT
o Writing a Client

DEPLOYMENT
o Manage Security
Settings
o Running Server &
Client

2

3

13
SERVICE INTERFACE: AN AGREEMENT
BETWEEN SERVER & CLIENT


Factorial Operation



Check Prime Operation



Square Operation

14
SERVER APPLICATION: WRITING A SERVICE
INTERFACE

15

Fig: MathService Interface
SERVER APPLICATION: IMPLEMENTING THE
SERVICE INTERFACE

16

Fig: MathServiceProvider implements MathService Interface
SERVER APPLICATION: INSTANTIATING &
BINDING THE SERVICE

17

Fig: Instantiating and Binding MathService Interface
A SIMPLE RMI APPLICATION

1

SERVER
oWriting an Interface
o Implementing an
Interface
o Binding Interface

CLIENT
o Writing a Client

DEPLOYMENT
o Manage Security
Settings
o Running Server &
Client

2

3

18
CLIENT APPLICATION: SERVICE LOOKUP

Fig: Client locating MathService service
19
CLIENT APPLICATION: ACCESSING SERVICE

Fig: Client accessing MathService service

20
A SIMPLE RMI APPLICATION

1

SERVER
oWriting an Interface
o Implementing an
Interface
o Binding Interface

CLIENT
o Writing a Client

DEPLOYMENT
o Manage Security
Settings
o Running Server &
Client

2

3

21
SERVER DEPLOYMENT: START RMI
REGISTRY


To start RMI registry on windows



To start RMI registry on Unix

22
SERVER DEPLOYMENT: COMPILE THE
SERVER


Compile both MathService interface and
MathServiceProvider class

23
SERVER DEPLOYMENT: CREATE SERVER
STUB


Create the server stub that will handle client call

24
SECURITY DEPLOYMENT: CREATE SECURITY
POLICY FILE (BOTH CLIENT & SERVER)
Create a security policy file called no.policy with
the following content and add it to CLASSPATH
 This step implies for both server and client


25
START THE SERVER


Execute the command to run server

26
SERVER RUNNING

27
START THE CLIENT


Execute the command to run client

28
CLIENT INTERFACE

29
ADVANCED CONCEPTS
Java Object Serialization
 Parameter Marshalling & Demarshalling
 Object Activation


30
STRENGTH OF JAVA RMI
Object Oriented: Can pass complex object rather
than only primitive types
 Mobile Behavior: Change of roles between client
and server easily
 Design Patterns: Encourages OO design patterns
as objects are transferred
 Safe & Secure: The security settings of Java
framework used
 Easy to Write /Easy to Use: Requires very little
coding to access service


31
STRENGTH OF JAVA RMI
Connects to Legacy Systems: JNI & JDBC
facilitate access.
 Write Once, Run Anywhere: 100% portable, run on
any machine having JVM
 Distributed Garbage Collection: Same principle like
memory garbage collection
 Parallel Computing: Through multi-threading RMI
server can serve numerous clients
 Distributed Computing Solutions: Available from
JDK 1.1, can communicate between all versions of
JDKs


32
WEAKNESS OF JAVA RMI
Tied to Java System: Purely Java-centric
technology, does not have good support for legacy
system written in C, C++, Ada etc.
 Performance Issue : Only good for large-grain
computation
 Security Restrictions & Complexities: Threats
during downloading objects from server, malicious
client request, added security complexity in policy
file.
 Overhead: Extra usage of rmic tool.


33
CASE STUDY: JAVA RMI

VS.

CORBA

34
CASE STUDY: JAVA RMI
Language Dependence:
 RMI service interface is in
Java
 CORBA service interface is
platform independent

VS.

CORBA

Mobile Behavior
 Server and client can change
roles in RMI
 Not feasible in CORBA

Performance Issue:
 RMI needs extra overhead for
conversion from byte code to machine
code
CORBA performs better for massive
computation like fluid mechanics

35
CASE STUDY: JAVA RMI
Ease of Use:
 RMI is easy to master for
experienced programmers.
 CORBA is a rich, extensive
family of standards, hard to
master

VS.

CORBA

Maturity of Technology
 RMI is less matured
 CORBA is more matured
and already has many
implementations running

36
JAVA RMI CUSTOMERS
IBM
 Swiss Federal Supreme Court
 CEAS Consulting
 Avitek
 Different Chat service Company
 More can be found here:
http://www.cs.mun.ca/~paul8/jdk1.2beta3/docs/guid
e/rmi/examples.html


37
CORBA CUSTOMERS
USA AG
 Cisco Systems
 American Airlines
 BHP Information Technology
 More can be found here:
http://www.corba.org/success.htm


38
CASE STUDY: JAVA RMI

VS.

CORBA

Results of case study:
o
o

No one is better than other necessarily
Applicability of one on another depends on


Purpose of the application
 Experience of the designer and developer
 Necessity of interoperability with non-java systems.

39
CONCLUSION
Distributed Object Technology
 Object level abstraction
 Object version of Java RPC
 Java centric Technology
 Comparable to CORBA, SOAP
 Provides non-java support with the help IDL, IIOP
and CORBA
 Lightweight and Easy to use
 Object serialization
 Concurrent support for clients


40
THANK YOU !!! QUESTIONS PLEASE?

41
REFERENCES
[1].Advantages of java RMI
http://www.oracle.com/technetwork/java/javase/tech/index-jsp-138781.html
[2] Java RMI architecture. http://www.cs.mun.ca/michael/java/jdk1.1-beta2docs/guide/rmi/rmi-arch.doc.html
[3] Introduction to java RMI
http://www.javacoffeebreak.com/articles/javarmi/javarmi.html.
[4] Java RMI: Remote method invocation.
http://www1.cs.columbia.edu/dcc/nestor/presentations/java-rmi/java-rmihandouts.pdf
[5] Disadvantages of RMI. http://www.coderanch.com/t/180297/javadeveloperSCJD/certification/RMI-Advantages-Disadvantages.
[6] Background of java rmi.
http://docs.oracle.com/javase/1.5.0/docs/guide/rmi/spec/rmi-intro2.html.
[7] How RMI works.
http://www.sce.carleton.ca/netmanage/simulator/rmi/RMIExplanation.htm
Please contact mor543@mail.usask.ca to get more.

42

More Related Content

PPSX
Java rmi
PDF
Agreement Protocols, distributed File Systems, Distributed Shared Memory
PPTX
Sequence diagram
PPT
Example of dfd with answer
PPT
PPT
PPT
Remote Method Invocation
PPTX
Spyware and rootkit
Java rmi
Agreement Protocols, distributed File Systems, Distributed Shared Memory
Sequence diagram
Example of dfd with answer
Remote Method Invocation
Spyware and rootkit

What's hot (20)

DOC
Naming in Distributed System
PPT
Object Oriented Database Management System
PPT
Use Case Diagram
PPT
3. challenges
PPTX
Client Server Architecture ppt
DOCX
Online shopping
PDF
online job portal system
DOCX
Placement management system
PPTX
Pharmacy management system project
PDF
System requirement system for restaurant management system.
PDF
Types of Threat Actors and Attack Vectors
PPTX
Software Engineering unit 3
PPTX
Market oriented Cloud Computing
PPT
Middleware
PPT
Chapter14 designing interfaces and dialogues
PPTX
Trojan virus & backdoors
PPTX
Event Management System Document
PDF
Chat Application | RSD
PPTX
Application security models
PPTX
DBMS ARCHITECTURE.pptx
Naming in Distributed System
Object Oriented Database Management System
Use Case Diagram
3. challenges
Client Server Architecture ppt
Online shopping
online job portal system
Placement management system
Pharmacy management system project
System requirement system for restaurant management system.
Types of Threat Actors and Attack Vectors
Software Engineering unit 3
Market oriented Cloud Computing
Middleware
Chapter14 designing interfaces and dialogues
Trojan virus & backdoors
Event Management System Document
Chat Application | RSD
Application security models
DBMS ARCHITECTURE.pptx
Ad

Similar to Java RMI Presentation (20)

PPTX
Java RMI
PDF
Remote Method Invocation in JAVA
PDF
Java RMI Detailed Tutorial
DOCX
Remote Method Invocation
PPTX
PDF
Java rmi tutorial
PDF
java TM rmi The Remote Method Invocation Guide 1st Edition Esmond Pitt
PPT
Java RMI
PPT
Distributed Objects and JAVA
PPTX
Java RMI
PPTX
Remote Method Invocation (Java RMI)
PDF
java TM rmi The Remote Method Invocation Guide 1st Edition Esmond Pitt
PDF
Remote Method Invocation, Advanced programming
PPTX
Rmi architecture
PDF
Introduction to Remote Method Invocation (RMI)
PDF
Remote Method Invocation (RMI)
PDF
JavaRMI, JAVA RPC , INTRO , DESCRIPTION , EXPLAINED.pdf
PPTX
Introduction To Rmi
PPTX
Remote Method Innovation (RMI) In JAVA
PPTX
Remote method invocatiom
Java RMI
Remote Method Invocation in JAVA
Java RMI Detailed Tutorial
Remote Method Invocation
Java rmi tutorial
java TM rmi The Remote Method Invocation Guide 1st Edition Esmond Pitt
Java RMI
Distributed Objects and JAVA
Java RMI
Remote Method Invocation (Java RMI)
java TM rmi The Remote Method Invocation Guide 1st Edition Esmond Pitt
Remote Method Invocation, Advanced programming
Rmi architecture
Introduction to Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
JavaRMI, JAVA RPC , INTRO , DESCRIPTION , EXPLAINED.pdf
Introduction To Rmi
Remote Method Innovation (RMI) In JAVA
Remote method invocatiom
Ad

More from Masud Rahman (20)

PDF
Explaining Software Bugs Leveraging Code Structures in Neural Machine Transla...
PDF
Can Hessian-Based Insights Support Fault Diagnosis in Attention-based Models?
PDF
Improved Detection and Diagnosis of Faults in Deep Neural Networks Using Hier...
PPTX
HereWeCode 2022: Dalhousie University
PPTX
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
PPTX
PhD Seminar - Masud Rahman, University of Saskatchewan
PPTX
PhD proposal of Masud Rahman
PPTX
PhD Comprehensive exam of Masud Rahman
PPTX
Doctoral Symposium of Masud Rahman
PPTX
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
PDF
Poster: Improving Bug Localization with Report Quality Dynamics and Query Ref...
PDF
Impact of Continuous Integration on Code Reviews
PPTX
Predicting Usefulness of Code Review Comments using Textual Features and Deve...
PPTX
STRICT: Information Retrieval Based Search Term Identification for Concept Lo...
PPTX
An Insight into the Unresolved Questions at Stack Overflow
PPTX
An Insight into the Pull Requests of GitHub
PPTX
Recommending Insightful Comments for Source Code using Crowdsourced Knowledge
PPTX
TextRank Based Search Term Identification for Software Change Tasks
PPTX
CMPT-842-BRACK
PPTX
RACK: Code Search in the IDE using Crowdsourced Knowledge
Explaining Software Bugs Leveraging Code Structures in Neural Machine Transla...
Can Hessian-Based Insights Support Fault Diagnosis in Attention-based Models?
Improved Detection and Diagnosis of Faults in Deep Neural Networks Using Hier...
HereWeCode 2022: Dalhousie University
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
PhD Seminar - Masud Rahman, University of Saskatchewan
PhD proposal of Masud Rahman
PhD Comprehensive exam of Masud Rahman
Doctoral Symposium of Masud Rahman
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
Poster: Improving Bug Localization with Report Quality Dynamics and Query Ref...
Impact of Continuous Integration on Code Reviews
Predicting Usefulness of Code Review Comments using Textual Features and Deve...
STRICT: Information Retrieval Based Search Term Identification for Concept Lo...
An Insight into the Unresolved Questions at Stack Overflow
An Insight into the Pull Requests of GitHub
Recommending Insightful Comments for Source Code using Crowdsourced Knowledge
TextRank Based Search Term Identification for Software Change Tasks
CMPT-842-BRACK
RACK: Code Search in the IDE using Crowdsourced Knowledge

Recently uploaded (20)

PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Institutional Correction lecture only . . .
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Computing-Curriculum for Schools in Ghana
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Presentation on HIE in infants and its manifestations
PPTX
master seminar digital applications in india
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Cell Structure & Organelles in detailed.
PDF
RMMM.pdf make it easy to upload and study
102 student loan defaulters named and shamed – Is someone you know on the list?
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Chinmaya Tiranga quiz Grand Finale.pdf
GDM (1) (1).pptx small presentation for students
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Microbial disease of the cardiovascular and lymphatic systems
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Institutional Correction lecture only . . .
O7-L3 Supply Chain Operations - ICLT Program
VCE English Exam - Section C Student Revision Booklet
01-Introduction-to-Information-Management.pdf
Microbial diseases, their pathogenesis and prophylaxis
Computing-Curriculum for Schools in Ghana
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Complications of Minimal Access Surgery at WLH
Presentation on HIE in infants and its manifestations
master seminar digital applications in india
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Cell Structure & Organelles in detailed.
RMMM.pdf make it easy to upload and study

Java RMI Presentation

  • 1. JAVA REMOTE METHOD INVOCATION (RMI) Mohammad Masudur Rahman [email protected] Department of Computer Science University of Saskatchewan Saskatoon, SK, S7N5C9 Date: April 09, 2013
  • 2. 2
  • 3. TUTORIAL CONTENTS Java Remote Method Invocation  Historical Background  Related Terminologies  RMI System Architecture   Layered Structures  Working Principles  A Simple RMI Application  Server, Client, Interface, Stubs  Security, Deployment, Invocation Strength & Weakness of RMI  RMI vs. CORBA Case Study  3
  • 4. JAVA REMOTE METHOD INVOCATION Fig: Distributed Object Technology 4
  • 5. JAVA REMOTE METHOD INVOCATION RMI Server, client, interface, stubs, skeletons  RMI Registry  Object version of RPC  Method Invocation between JVMs  Java RMI API  JRMP (Java Remote Method Protocol)  Java object serialization  Parameter Marshalling  5
  • 6. HISTORICAL BACKGROUND Abstraction: Low level Java Sockets by SUN Abstraction: Procedure level Java RPC by SUN Abstraction: Object level CORBA by OMG Java RMI by SUN SOAP by Microsoft 6
  • 7. RELATED TERMINOLOGIES RPC (Remote Procedure Call)  XDR (External Data Representation)  CORBA (Common Object Request Broker Architecture)  IIOP (Internet Inter-ORB Protocol)  Java IDL (Interface Definition Language)  RMI-IIOP  SOAP (Simple Object Access Protocol)  7
  • 8. RMI SYSTEM ARCHITECTURE Lets divide into two perspectives:  Layered Structure  Working Principles 8
  • 9. RMI LAYERED STRUCTURE Fig: RMI Layered Structure 9
  • 10. RMI LAYERED STRUCTURE Application layer: Server, Client  Interface: Client stub, Server skeleton  Remote Reference layer: RMI registry  Transport layer: HTTP  10
  • 11. RMI WORKING PRINCIPLES Fig: RMI Working principles 11
  • 12. READY TO DEVELOP ONE? 12
  • 13. A SIMPLE RMI APPLICATION 1 SERVER oWriting an Interface o Implementing an Interface o Binding Interface CLIENT o Writing a Client DEPLOYMENT o Manage Security Settings o Running Server & Client 2 3 13
  • 14. SERVICE INTERFACE: AN AGREEMENT BETWEEN SERVER & CLIENT  Factorial Operation  Check Prime Operation  Square Operation 14
  • 15. SERVER APPLICATION: WRITING A SERVICE INTERFACE 15 Fig: MathService Interface
  • 16. SERVER APPLICATION: IMPLEMENTING THE SERVICE INTERFACE 16 Fig: MathServiceProvider implements MathService Interface
  • 17. SERVER APPLICATION: INSTANTIATING & BINDING THE SERVICE 17 Fig: Instantiating and Binding MathService Interface
  • 18. A SIMPLE RMI APPLICATION 1 SERVER oWriting an Interface o Implementing an Interface o Binding Interface CLIENT o Writing a Client DEPLOYMENT o Manage Security Settings o Running Server & Client 2 3 18
  • 19. CLIENT APPLICATION: SERVICE LOOKUP Fig: Client locating MathService service 19
  • 20. CLIENT APPLICATION: ACCESSING SERVICE Fig: Client accessing MathService service 20
  • 21. A SIMPLE RMI APPLICATION 1 SERVER oWriting an Interface o Implementing an Interface o Binding Interface CLIENT o Writing a Client DEPLOYMENT o Manage Security Settings o Running Server & Client 2 3 21
  • 22. SERVER DEPLOYMENT: START RMI REGISTRY  To start RMI registry on windows  To start RMI registry on Unix 22
  • 23. SERVER DEPLOYMENT: COMPILE THE SERVER  Compile both MathService interface and MathServiceProvider class 23
  • 24. SERVER DEPLOYMENT: CREATE SERVER STUB  Create the server stub that will handle client call 24
  • 25. SECURITY DEPLOYMENT: CREATE SECURITY POLICY FILE (BOTH CLIENT & SERVER) Create a security policy file called no.policy with the following content and add it to CLASSPATH  This step implies for both server and client  25
  • 26. START THE SERVER  Execute the command to run server 26
  • 28. START THE CLIENT  Execute the command to run client 28
  • 30. ADVANCED CONCEPTS Java Object Serialization  Parameter Marshalling & Demarshalling  Object Activation  30
  • 31. STRENGTH OF JAVA RMI Object Oriented: Can pass complex object rather than only primitive types  Mobile Behavior: Change of roles between client and server easily  Design Patterns: Encourages OO design patterns as objects are transferred  Safe & Secure: The security settings of Java framework used  Easy to Write /Easy to Use: Requires very little coding to access service  31
  • 32. STRENGTH OF JAVA RMI Connects to Legacy Systems: JNI & JDBC facilitate access.  Write Once, Run Anywhere: 100% portable, run on any machine having JVM  Distributed Garbage Collection: Same principle like memory garbage collection  Parallel Computing: Through multi-threading RMI server can serve numerous clients  Distributed Computing Solutions: Available from JDK 1.1, can communicate between all versions of JDKs  32
  • 33. WEAKNESS OF JAVA RMI Tied to Java System: Purely Java-centric technology, does not have good support for legacy system written in C, C++, Ada etc.  Performance Issue : Only good for large-grain computation  Security Restrictions & Complexities: Threats during downloading objects from server, malicious client request, added security complexity in policy file.  Overhead: Extra usage of rmic tool.  33
  • 34. CASE STUDY: JAVA RMI VS. CORBA 34
  • 35. CASE STUDY: JAVA RMI Language Dependence:  RMI service interface is in Java  CORBA service interface is platform independent VS. CORBA Mobile Behavior  Server and client can change roles in RMI  Not feasible in CORBA Performance Issue:  RMI needs extra overhead for conversion from byte code to machine code CORBA performs better for massive computation like fluid mechanics 35
  • 36. CASE STUDY: JAVA RMI Ease of Use:  RMI is easy to master for experienced programmers.  CORBA is a rich, extensive family of standards, hard to master VS. CORBA Maturity of Technology  RMI is less matured  CORBA is more matured and already has many implementations running 36
  • 37. JAVA RMI CUSTOMERS IBM  Swiss Federal Supreme Court  CEAS Consulting  Avitek  Different Chat service Company  More can be found here: http://www.cs.mun.ca/~paul8/jdk1.2beta3/docs/guid e/rmi/examples.html  37
  • 38. CORBA CUSTOMERS USA AG  Cisco Systems  American Airlines  BHP Information Technology  More can be found here: http://www.corba.org/success.htm  38
  • 39. CASE STUDY: JAVA RMI VS. CORBA Results of case study: o o No one is better than other necessarily Applicability of one on another depends on  Purpose of the application  Experience of the designer and developer  Necessity of interoperability with non-java systems. 39
  • 40. CONCLUSION Distributed Object Technology  Object level abstraction  Object version of Java RPC  Java centric Technology  Comparable to CORBA, SOAP  Provides non-java support with the help IDL, IIOP and CORBA  Lightweight and Easy to use  Object serialization  Concurrent support for clients  40
  • 41. THANK YOU !!! QUESTIONS PLEASE? 41
  • 42. REFERENCES [1].Advantages of java RMI http://www.oracle.com/technetwork/java/javase/tech/index-jsp-138781.html [2] Java RMI architecture. http://www.cs.mun.ca/michael/java/jdk1.1-beta2docs/guide/rmi/rmi-arch.doc.html [3] Introduction to java RMI http://www.javacoffeebreak.com/articles/javarmi/javarmi.html. [4] Java RMI: Remote method invocation. http://www1.cs.columbia.edu/dcc/nestor/presentations/java-rmi/java-rmihandouts.pdf [5] Disadvantages of RMI. http://www.coderanch.com/t/180297/javadeveloperSCJD/certification/RMI-Advantages-Disadvantages. [6] Background of java rmi. http://docs.oracle.com/javase/1.5.0/docs/guide/rmi/spec/rmi-intro2.html. [7] How RMI works. http://www.sce.carleton.ca/netmanage/simulator/rmi/RMIExplanation.htm Please contact [email protected] to get more. 42

Editor's Notes

  • #2: Hello everybody, welcome to my presentation.This is Mohammad Masudur Rahman.Today, I am going to talk about a very interesting topic about distributed computing called Remote Method Invocation.Hope you will enjoy the topic.
  • #3: RMI is copyrighted by Sun Micro systemCurrently SUN is taken by Oracle, so, now this technology belongs to Oracle corporation.
  • #4: In my presentation, I am going to cover the following topics I am not going to read it out, but we will try to go step by step.
  • #5: Before discussing about Java RMI,the very first thing I would like to focus.What is a distributed object technology (DOT)?Also, what is the difference between web application and web service?So, concept is pretty simple like this diagram. When a machine can access the functionality of an object situated in a remote machine and exploit the computation power of the remote machine, then we can call it as a distributed object technology (DOT)Java RMI is a perfect example of distributed object technology. Other similar types of technology is CORBA, SOAP etc.
  • #6: As mentioned, Java RMI is a distributed object based technology that means it provides object level abstraction to the developer.For example, the developer needs to access some functionality of a remote object, Java RMI manages to allow the developers to call that remote object from his program just like a local class object. This was a cool thing when the concept was first started by Sun Microsystems and whole features were packaged as a Java Library with SDK.It is also considered as an object version of Java RPC which provides procedure level abstraction to the developer.Java RMI is basically a Java based technology and any machine containing JVM can host a distributed object server or client. However, it involves several components like service interface, RMI registry, skeleton, stubs etc which will discuss in the later slides.The are also some advanced features related to RMI like object serialization, parameter marshalling on which we will try to provide some overview.
  • #7: Lets take a look into the technology hierarchy.The primary communication technology is Socket in Java : abstraction is low level, that means developer needs to think about more details about the technology rather than his application which is time-consuming.The next level is RPC, which provides method level abstraction, that means to call a remote method, you have to provide the method name and parameters though some RPC Client to get access to the functionality; that means, still you need to care about method name, type and # of parameters which may not be comfortable for all.The next level is object level technology which provides object level abstraction. Other parallel object technology is CORBA by OMG and SOAP by Microsoft.CORBA is C++ in server, but the service interface is implemented in IDL (Interface definition language) which is platform independent, so, any client can communicate with it. IDL creates different service interfaces for different clients.SOAP is mainly intended for web service architecture. Any client having access to WSDL file can actually access the service.
  • #8: XDR = External data representation, a data format for network transmission, developed by Sun Microsystems, 1980 Encoding > XDR >Decoding of data.Base unit is 4 bytes.CORBA= Common Object Request Broker Architecture, client and server both communicate with the ORB (Object Request Broker) to get and provide service.IIOP = ORB protocol over the Internet which started on 1994 to provide a greater degree of interoperability.Java IDL = Provides Java interface definition to different other languages.RMI IIOP=Java RMI over IIOP, that means RMI uses IIOP to exploit the CORBA features like OMG IDL or non-java platform access.
  • #9: Lets focus on RMI architecture. The discussion will be two-folds:Layered based architectureWorking principles based
  • #10: Here, we can see a list of layers in the RMI protocol.In the application layer, there are client and server who are the end-consumer and end-producer of the service. They communicate with intermediate layer called stub-skeleton layer.In stub-skeleton layer, stub is related to client application which actually transmits the request to the next level. The skeleton is a component which is associated with server and is responsible to make the actual request to the server.Remote reference layer contains the RMI registry and it works like a ORB in CORBA, that means, it handles the request and response between client and server. Once the client gets the remote object reference from the RMI registry, it can make request and this layer transmits that request to the appropriate server. Again, when server responds, it also sends back the response to the client. It also manages other advanced tasks like object activation , object serialization management, distributed garbage collection etc.Transport layer handles network communication between client and server.
  • #11: We have discussed these already.
  • #12: Now comes the working principles.We can see the following steps:Client requests for the remote object reference to naming serviceOnce the naming service locates the server host, RMI registry provides a stub (proxy) of remote object.Client can make call using the stubBasically, the request from the stub is sent to the server skeleton which makes the actual request to the remote object.Similarly, the server response is sent back through skeleton and stub to the client.
  • #13: Now, we will show how to develop a simple RMI application.
  • #14: There are 3 major steps for this development.Service contract establishment and server application developmentClient application developmentDeployment of service
  • #15: First comes the service contract.Suppose, the client and server are agreed upon this contract that there will be 3 operations:Factorial operationPrime check operationSquare operationI kept the examples simple for easy understanding.
  • #16: And here is the complete interface. We developed it using Java interface. We named it MathService.
  • #17: Here, the serverapplication implements the service interface.
  • #18: This code binds the MathService to the RMI registry so that client app can get the reference of the serviceAnd consume the service.Interestingly, client can actually access the reference of interface MathService to make call, however, the respond is provided by the object implementing the service.
  • #19: Now comes the client application development.
  • #20: Here, we can see, client accesses the Naming. lookup() method to get the reference of the remote object.
  • #21: Once it gets the reference, client can call the method just like it is calling a local object method.This is the strength of Java RMI technology.
  • #22: Now comes the deployment.
  • #23: We need to start the RMI registry service to deploy the remote object; server object.
  • #24: Here we are compiling both service and server object.
  • #25: Then we are creating skeleton of server object. This step is deprecated from JDK 1.5 as JDK automatically creates it.The developer does not need to do it manually now.
  • #26: Now comes the crucial part on which often most of time we get stuck.That is the security policy of Java RMI.The default security does not support the RMI call, so, we need to set custom permission for the call to the security manager.This phase is required for both the client and server.Basically, we have to create a <any name>.policy file with this content. Here, we allowed all types of call associated with Java RMI;That is why it contains AllPermission.
  • #27: This is how the server object should be deployed.
  • #28: This is how we did.
  • #29: This is how the client needs to be run for RMI service access. Please note that we have to specify the host name.
  • #30: This is how we did for the client. However, we also developed the Java object serialization by this time.
  • #31: There are advance stuffs which I would like to provide some overview.Java Object serialization: It involves converting the object into a sequence of byte streams where there needs a swapping of java object between client and the server. Basically, if client or server uses a user-defined class as parameters, then they need the object serialization.Parameter Marshalling is a type of serialization for parameters handled by the stub-skeleton layer. Demarshalling refers to de-serialization.Object Activation: In some scenarios, server may not be running always, then object reference layer activates the target remote object (server) to enable it to respond to the client’s request. Common for infrequent RMI call.The detail discussion of those topics is beyond this tutorial, because each of them will be a single tutorial.
  • #32: These are strengths of Java RMI.-Object oriented, object level abstraction.-Mobile behavior: that means the roles between client and server can be exchanged easily.-It supports the design pattern-sate and secure like the Java technology.
  • #33: -It can support the legacy system.-Write once, run everywhere-Distributed garbage collection, like the one provide by Java.-facilitates the parallel computing.-Widely supported by different versions of JDK, as it was from the beginning, JDK 1.1
  • #34: It also got some weaknesses.-Tied to Java system, that means it a Java only technology, cant communicate well with the non-java platform.-Due to byte code step, the computation is slower.-Additional complexity for security which many developers didn’t like.-Extra step with rmic compilation
  • #35: Now, we will do a comparative study between RMI and its parallel technologyCORBA
  • #36: We will choose several perspective to compare between these two technologies:Language dependence: Java is tied to Java, that means client server and interface all are in java, but its not the case in CORBA. The core/server of CORBA in C++, but the IDL provides language specific service interface, so that any client can call the server. This makes CORBA platform language independent service.Mobile behavior: Java RMI can show it as the roles between client and server can be easily exchanged; not possible for CORBAPerformance Issue: For byte code step, Java RMI fall backs in heavy computation. On the other hand, C++ of CORBA is compiling language and performs faster
  • #37: There are more:4. Ease of use: RMI is easy to use, but CORBA is complex and may not easy for all.5. Maturity: CORBA is a matured technology and already lots of applications are using this technology, whereas RMI is less matured compared to it.
  • #38: Java RMI has got several big customers due to its remarking features.
  • #39: CORBA is a well established technology and started earlier than RMI. It got huge audience. Please check the link for details.Few are shown here.
  • #40: So>None is better than otherYou need to choose based on the scope and type of the technical requirements.For example, if you need low overhead, easy to use technique and platform independence is not a requirement, then you can choose RMIFor opposite reasons, you can choose CORBA, but beware of the expertise of the developers
  • #41: So, we have got couple of conclusions to make.Discuss on your own.