Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

Building Distributed Applications using JAVA - RMI
COS 461 Fall 1997 Network Objects u first good implementation: DEC SRC Network Objects for Modula-3 u recent implementation: Java RMI (Remote Method Invocation)
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
RMI Varun SainiYing Chen. What is RMI? RMI is the action of invoking a method of a remote interface on a remote object. It is used to develop applications.
Remote Procedure Call Design issues Implementation RPC programming
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Remote Method Invocation in Java Bennie Lewis EEL 6897.
Advanced Programming Rabie A. Ramadan Lecture 4. A Simple Use of Java Remote Method Invocation (RMI) 2.
Java Remote Method Invocation (RMI) In Java we implement object systems: O1O2 O3 thread 1thread 2 execution scheme JVM 1JVM 2 distribution scheme.
Remote Method Invocation
The road to reliable, autonomous distributed systems
Company LOGO Remote Method Invocation Georgi Cholakov, Emil Doychev, University of Plovdiv “Paisii.
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
1 HANDOUT 14 Remote Method Invocation (RMI) BY GEORGE KOUTSOGIANNAKIS THIS DOCUMENT CAN NOT BE REPRODUCED OR DISTRIBUTED WITHOUT TH E WRITTEN PERMISSION.
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Introduction to Remote Method Invocation (RMI)
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Communication in Distributed Systems –Part 2
Client-Server Communication Sockets Remote Procedure Calls Remote Method Invocation (Java)
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Java RMI Essentials Based on Mastering RMI Rickard Oberg.
1 Java Programming II Java Network II (Distributed Objects in Java)
+ A Short Java RMI Tutorial Usman Saleem
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
11 September 2008CIS 340 # 1 Topics To examine the variety of approaches to handle the middle- interaction (continued) 1.RPC-based systems 2.TP monitors.
Java Remote Method Invocation (RMI) ). Distributed Systems  a collection of independent computers that appears to its users as a single coherent system.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
Java Remote Method Invocation RMI. Idea If objects communicate with each other on one JVM why not do the same on several JVM’s? If objects communicate.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Java Programming: Advanced Topics 1 Networking Programming Chapter 11.
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 17/10/2007.
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Eric Tryon Brian Clark Christopher McKeowen. System Architecture The architecture can be broken down to three different basic layers Stub/skeleton layer.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Remote Method Invocation RMI architecture stubs and skeletons for remote services RMI server and client in Java Creating an RMI Application step-by- step.
1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation.
Java Distributed Object Model A remote object is one whose methods can be invoked from another JVM on a different host. It implements one or more remote.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Java Distributed Computing
Chapter 4 Remote Method Invocation
Java Distributed Computing
Java Remote Method Invocation (RMI)
Remote Method Invocation
What is RMI? Remote Method Invocation
Remote Method Invocation
Network and Distributed Programming in Java
Programming Models for Distributed Application
Chapter 40 Remote Method Invocation
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
Overview of RMI Architecture
Distribution Infrastructures
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
Java Remote Method Invocation
Overview of RMI Architecture
Presentation transcript:

Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage Collection RMI & the OSI Reference Model Security Programming with RMI

Copyright © 2001 Qusay H. Mahmoud Introduction Low-level sockets can be used to develop client/server distributed applications But in that case, a protocol must be designed Designing such a protocol is hard and error- prone (how to avoid deadlock?) RMI is an alternative to sockets

Copyright © 2001 Qusay H. Mahmoud What is RMI? A core package of the JDK1.1+ that can be used to develop distributed applications Similar to the RPC mechanism found on other systems In RMI, methods of remote objects can be invoked from other JVMs In doing so, the programmer has the illusion of calling a local method (but all arguments are actually sent to the remote object and results sent back to callers)

Copyright © 2001 Qusay H. Mahmoud Local v. Remote method invocation

Copyright © 2001 Qusay H. Mahmoud Goals and Features of RMI seamless object remote invocations callbacks from server to client distributed garbage collection NOTE: in RMI, all objects must be written in Java!

Copyright © 2001 Qusay H. Mahmoud RMI System Architecture Built in three layers (they are all independent): – Stub/Skeleton layer – Remote reference layer – Transport layer

Copyright © 2001 Qusay H. Mahmoud The Stub/Skeleton layer The interface between the application layer and the rest of the system Stubs and skeletons are generated using the RMIC compiler This layer transmits data to the remote reference layer via the abstraction of marshal streams (that use object serialization) This layer doesn’t deal with the specifics of any transport

Copyright © 2001 Qusay H. Mahmoud The Stub/Skeleton l Client stub responsible for: – Initiate remote calls – Marshal arguments to be sent – Inform the remote reference layer to invoke the call – Unmarshaling the return value – Inform remote reference the call is complete Server skeleton responsible for: – Unmarshaling incoming arguments from client – Calling the actual remote object implementation – Marshaling the return value for transport back to client

Copyright © 2001 Qusay H. Mahmoud The Remote Reference Layer The middle layer Provides the ability to support varying remote reference or invocation protocols independent of the client stub and server skeleton Example: the unicast protocol provides point- to-point invocation, and multicast provides invocation to replicated groups of objects, other protocols may deal with different strategies… Not all these features are supported….

Copyright © 2001 Qusay H. Mahmoud The Transport Layer A low-level layer that ships serialized objects between different address spaces Responsible for: – Setting up connections to remote address spaces – Managing the connections – Listening to incoming calls – Maintaining a table of remote objects that reside in the same address space – Setting up connections for an incoming call – Locating the dispatcher for the target of the remote call

Copyright © 2001 Qusay H. Mahmoud How does RMI work? An invocation will pass through the stub/skeleton layer, which will transfer data to the remote reference layer The semantics of the invocation are carried to the transport layer The transport layer is responsible for setting up the connection

Copyright © 2001 Qusay H. Mahmoud The Naming Registry The remote object must register itself with the RMI naming registry A reference to the remote object is obtained by the client by looking up the registry

Copyright © 2001 Qusay H. Mahmoud Distributed Garbage Collection RMI provides a distributed garbage collector that deletes remote objects no longer referenced by a client Uses a reference-counting algorithm to keep track of live references in each Virtual Machine RMI keeps track of VM identifiers, so objects are collected when no local or remote references to them

Copyright © 2001 Qusay H. Mahmoud RMI and the OSI reference model How can RMI be described by this model?

Copyright © 2001 Qusay H. Mahmoud Security While RMI is a straightforward method for creating distributed applications, some security issues you should be aware of: – Objects are serialized and transmitted over the network in plain text – No authentication: a client requests an object, all subsequent communication is assumed to be from the same client – No Security checks on the register – No version control

Copyright © 2001 Qusay H. Mahmoud Programming with RMI Anatomy of an RMI-based application – Define a remote interface – Provide an implementation of the remote interface – Develop a client – Generate stubs and skeletons – Start the RMI registry – Run the client and server

Copyright © 2001 Qusay H. Mahmoud Define a remote interface It specifies the characteristics of the methods provided by a server and visible to clients – Method signatures (method names and the type of their parameters) By looking at the interface, programmers know what methods are supported and how to invoke them Remote method invocations must be able to handle error messages (e.g. can’t connect to server or server is down)

Copyright © 2001 Qusay H. Mahmoud Characteristics of remote interface Must be declared public To make an object a remote one, the interface must extend the java.rmi.Remote interface Each method declared in the interface must declare java.rmi.RemoteException in its throws clause. see DateServer example

Copyright © 2001 Qusay H. Mahmoud Implement the remote interface The implementation needs to: – Specify the remote interface being implemented – Define the constructor of the remote object – Implement the methods that can be invoked remotely – Create an instance of a remote object – Register it with the RMI registry see DateServerImpl example

Copyright © 2001 Qusay H. Mahmoud Develop a client Example: DateClient.java

Copyright © 2001 Qusay H. Mahmoud Generate stubs and skeletons Use the rmic compiler Place the remote interface and the stub class on the client side, and both the stub and skeleton on the server side. – alternately, some of these files could be dynamically loaded (will see this later)

Copyright © 2001 Qusay H. Mahmoud Start the RMI registry It is a naming service that allows clients to obtains references to remote objects

Copyright © 2001 Qusay H. Mahmoud Run the server and client Run the rmi registery (default port: 1099) Run the server Run the client

Copyright © 2001 Qusay H. Mahmoud Working with the RMI Registry refer to the java.rmi.Naming class

Copyright © 2001 Qusay H. Mahmoud What else? Dynamically loading stubs and skeletons Implementing callbacks Implementing factories How to sign objects over RMI How to create custom RMI socket factories SSL sockets Remote object activation