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

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Rmi ppt
Rmi pptRmi ppt
Rmi ppt
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Advanced java
Advanced java Advanced java
Advanced java
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
 
JNDI
JNDIJNDI
JNDI
 
ASP.NET State management
ASP.NET State managementASP.NET State management
ASP.NET State management
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Remote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVARemote Method Innovation (RMI) In JAVA
Remote Method Innovation (RMI) In JAVA
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Java RMI
Java RMIJava RMI
Java RMI
 
JavaFX Presentation
JavaFX PresentationJavaFX Presentation
JavaFX Presentation
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jsp
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 

Similar a Java RMI Presentation

Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocationashishspace
 
Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8
Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8
Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8helpsoft01
 
Rpc, Rmi And Webservices 2
Rpc, Rmi And Webservices 2Rpc, Rmi And Webservices 2
Rpc, Rmi And Webservices 2groupe0D
 
Resilient and Adaptable Systems with Cloud Native APIs
Resilient and Adaptable Systems with Cloud Native APIsResilient and Adaptable Systems with Cloud Native APIs
Resilient and Adaptable Systems with Cloud Native APIsVMware Tanzu
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method InvocationSonali Parab
 
A Pulsar Use Case In Federated Learning - Pulsar Summit NA 2021
A Pulsar Use Case In Federated Learning - Pulsar Summit NA 2021A Pulsar Use Case In Federated Learning - Pulsar Summit NA 2021
A Pulsar Use Case In Federated Learning - Pulsar Summit NA 2021StreamNative
 
Scaling Databricks to Run Data and ML Workloads on Millions of VMs
Scaling Databricks to Run Data and ML Workloads on Millions of VMsScaling Databricks to Run Data and ML Workloads on Millions of VMs
Scaling Databricks to Run Data and ML Workloads on Millions of VMsMatei Zaharia
 
vFabric - Ideal Platform for SaaS Apps
vFabric - Ideal Platform for SaaS AppsvFabric - Ideal Platform for SaaS Apps
vFabric - Ideal Platform for SaaS AppsVMware vFabric
 
Distributed Programming using RMI
 Distributed Programming using RMI Distributed Programming using RMI
Distributed Programming using RMIbackdoor
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMIbackdoor
 
#VMUGMTL - Radware Breakout
#VMUGMTL - Radware Breakout#VMUGMTL - Radware Breakout
#VMUGMTL - Radware Breakout1CloudRoad.com
 
Radware bringing mission and performance critical applications to cloud sta...
Radware   bringing mission and performance critical applications to cloud sta...Radware   bringing mission and performance critical applications to cloud sta...
Radware bringing mission and performance critical applications to cloud sta...ShapeBlue
 
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 interview questions for freshers
Java interview questions for freshersJava interview questions for freshers
Java interview questions for freshersSkillPracticalEdTech
 
Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01heenamithadiya
 

Similar a Java RMI Presentation (20)

Remote method invocatiom
Remote method invocatiomRemote method invocatiom
Remote method invocatiom
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8
Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8
Comparison between-rpc-rmi-and-webservices-son-1228374226080667-8
 
Rpc, Rmi And Webservices 2
Rpc, Rmi And Webservices 2Rpc, Rmi And Webservices 2
Rpc, Rmi And Webservices 2
 
Resilient and Adaptable Systems with Cloud Native APIs
Resilient and Adaptable Systems with Cloud Native APIsResilient and Adaptable Systems with Cloud Native APIs
Resilient and Adaptable Systems with Cloud Native APIs
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
A Pulsar Use Case In Federated Learning - Pulsar Summit NA 2021
A Pulsar Use Case In Federated Learning - Pulsar Summit NA 2021A Pulsar Use Case In Federated Learning - Pulsar Summit NA 2021
A Pulsar Use Case In Federated Learning - Pulsar Summit NA 2021
 
DS
DSDS
DS
 
6. The grid-COMPUTING OGSA and WSRF
6. The grid-COMPUTING OGSA and WSRF6. The grid-COMPUTING OGSA and WSRF
6. The grid-COMPUTING OGSA and WSRF
 
Scaling Databricks to Run Data and ML Workloads on Millions of VMs
Scaling Databricks to Run Data and ML Workloads on Millions of VMsScaling Databricks to Run Data and ML Workloads on Millions of VMs
Scaling Databricks to Run Data and ML Workloads on Millions of VMs
 
vFabric - Ideal Platform for SaaS Apps
vFabric - Ideal Platform for SaaS AppsvFabric - Ideal Platform for SaaS Apps
vFabric - Ideal Platform for SaaS Apps
 
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
 
#VMUGMTL - Radware Breakout
#VMUGMTL - Radware Breakout#VMUGMTL - Radware Breakout
#VMUGMTL - Radware Breakout
 
Radware bringing mission and performance critical applications to cloud sta...
Radware   bringing mission and performance critical applications to cloud sta...Radware   bringing mission and performance critical applications to cloud sta...
Radware bringing mission and performance critical applications to cloud sta...
 
Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)Introduction to Remote Method Invocation (RMI)
Introduction to Remote Method Invocation (RMI)
 
Web 2.0 Development with IBM DB2
Web 2.0 Development with IBM DB2Web 2.0 Development with IBM DB2
Web 2.0 Development with IBM DB2
 
batch-4.pptx
batch-4.pptxbatch-4.pptx
batch-4.pptx
 
Java interview questions for freshers
Java interview questions for freshersJava interview questions for freshers
Java interview questions for freshers
 
Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01Javarmi 130925082348-phpapp01
Javarmi 130925082348-phpapp01
 

Más de Masud Rahman

HereWeCode 2022: Dalhousie University
HereWeCode 2022: Dalhousie UniversityHereWeCode 2022: Dalhousie University
HereWeCode 2022: Dalhousie UniversityMasud Rahman
 
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...Masud Rahman
 
PhD Seminar - Masud Rahman, University of Saskatchewan
PhD Seminar - Masud Rahman, University of SaskatchewanPhD Seminar - Masud Rahman, University of Saskatchewan
PhD Seminar - Masud Rahman, University of SaskatchewanMasud Rahman
 
PhD proposal of Masud Rahman
PhD proposal of Masud RahmanPhD proposal of Masud Rahman
PhD proposal of Masud RahmanMasud Rahman
 
PhD Comprehensive exam of Masud Rahman
PhD Comprehensive exam of Masud RahmanPhD Comprehensive exam of Masud Rahman
PhD Comprehensive exam of Masud RahmanMasud Rahman
 
Doctoral Symposium of Masud Rahman
Doctoral Symposium of Masud RahmanDoctoral Symposium of Masud Rahman
Doctoral Symposium of Masud RahmanMasud Rahman
 
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...Masud Rahman
 
ICSE2018-Poster-Bug-Localization
ICSE2018-Poster-Bug-LocalizationICSE2018-Poster-Bug-Localization
ICSE2018-Poster-Bug-LocalizationMasud Rahman
 
CodeInsight-SCAM2015
CodeInsight-SCAM2015CodeInsight-SCAM2015
CodeInsight-SCAM2015Masud Rahman
 
RACK-Tool-ICSE2017
RACK-Tool-ICSE2017RACK-Tool-ICSE2017
RACK-Tool-ICSE2017Masud Rahman
 
QUICKAR-ASE2016-Singapore
QUICKAR-ASE2016-SingaporeQUICKAR-ASE2016-Singapore
QUICKAR-ASE2016-SingaporeMasud Rahman
 
CORRECT-ToolDemo-ASE2016
CORRECT-ToolDemo-ASE2016CORRECT-ToolDemo-ASE2016
CORRECT-ToolDemo-ASE2016Masud Rahman
 

Más de Masud Rahman (20)

HereWeCode 2022: Dalhousie University
HereWeCode 2022: Dalhousie UniversityHereWeCode 2022: Dalhousie University
HereWeCode 2022: Dalhousie University
 
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
The Forgotten Role of Search Queries in IR-based Bug Localization: An Empiric...
 
PhD Seminar - Masud Rahman, University of Saskatchewan
PhD Seminar - Masud Rahman, University of SaskatchewanPhD Seminar - Masud Rahman, University of Saskatchewan
PhD Seminar - Masud Rahman, University of Saskatchewan
 
PhD proposal of Masud Rahman
PhD proposal of Masud RahmanPhD proposal of Masud Rahman
PhD proposal of Masud Rahman
 
PhD Comprehensive exam of Masud Rahman
PhD Comprehensive exam of Masud RahmanPhD Comprehensive exam of Masud Rahman
PhD Comprehensive exam of Masud Rahman
 
Doctoral Symposium of Masud Rahman
Doctoral Symposium of Masud RahmanDoctoral Symposium of Masud Rahman
Doctoral Symposium of Masud Rahman
 
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
Supporting Source Code Search with Context-Aware and Semantics-Driven Code Se...
 
ICSE2018-Poster-Bug-Localization
ICSE2018-Poster-Bug-LocalizationICSE2018-Poster-Bug-Localization
ICSE2018-Poster-Bug-Localization
 
MSR2017-Challenge
MSR2017-ChallengeMSR2017-Challenge
MSR2017-Challenge
 
MSR2017-RevHelper
MSR2017-RevHelperMSR2017-RevHelper
MSR2017-RevHelper
 
STRICT-SANER2017
STRICT-SANER2017STRICT-SANER2017
STRICT-SANER2017
 
MSR2015-Challenge
MSR2015-ChallengeMSR2015-Challenge
MSR2015-Challenge
 
MSR2014-Challenge
MSR2014-ChallengeMSR2014-Challenge
MSR2014-Challenge
 
CodeInsight-SCAM2015
CodeInsight-SCAM2015CodeInsight-SCAM2015
CodeInsight-SCAM2015
 
STRICT-SANER2015
STRICT-SANER2015STRICT-SANER2015
STRICT-SANER2015
 
CMPT-842-BRACK
CMPT-842-BRACKCMPT-842-BRACK
CMPT-842-BRACK
 
RACK-Tool-ICSE2017
RACK-Tool-ICSE2017RACK-Tool-ICSE2017
RACK-Tool-ICSE2017
 
RACK-SANER2016
RACK-SANER2016RACK-SANER2016
RACK-SANER2016
 
QUICKAR-ASE2016-Singapore
QUICKAR-ASE2016-SingaporeQUICKAR-ASE2016-Singapore
QUICKAR-ASE2016-Singapore
 
CORRECT-ToolDemo-ASE2016
CORRECT-ToolDemo-ASE2016CORRECT-ToolDemo-ASE2016
CORRECT-ToolDemo-ASE2016
 

Último

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
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
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 

Último (20)

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
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"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
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
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 

Java RMI Presentation

  • 1. 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. 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 mor543@mail.usask.ca to get more. 42

Notas del editor

  1. 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.
  2. RMI is copyrighted by Sun Micro systemCurrently SUN is taken by Oracle, so, now this technology belongs to Oracle corporation.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. Lets focus on RMI architecture. The discussion will be two-folds:Layered based architectureWorking principles based
  9. 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.
  10. We have discussed these already.
  11. 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.
  12. Now, we will show how to develop a simple RMI application.
  13. There are 3 major steps for this development.Service contract establishment and server application developmentClient application developmentDeployment of service
  14. 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.
  15. And here is the complete interface. We developed it using Java interface. We named it MathService.
  16. Here, the serverapplication implements the service interface.
  17. 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.
  18. Now comes the client application development.
  19. Here, we can see, client accesses the Naming. lookup() method to get the reference of the remote object.
  20. 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.
  21. Now comes the deployment.
  22. We need to start the RMI registry service to deploy the remote object; server object.
  23. Here we are compiling both service and server object.
  24. 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.
  25. 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.
  26. This is how the server object should be deployed.
  27. This is how we did.
  28. This is how the client needs to be run for RMI service access. Please note that we have to specify the host name.
  29. This is how we did for the client. However, we also developed the Java object serialization by this time.
  30. 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.
  31. 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.
  32. -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
  33. 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
  34. Now, we will do a comparative study between RMI and its parallel technologyCORBA
  35. 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
  36. 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.
  37. Java RMI has got several big customers due to its remarking features.
  38. 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.
  39. 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
  40. So, we have got couple of conclusions to make.Discuss on your own.