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.

Slides:



Advertisements
Similar presentations
CS Network Programming CS 3331 Fall CS 3331 Outline Socket programming Remote method invocation (RMI)
Advertisements

Message Passing Vs Distributed Objects
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Remote method invocation. Introduction First introduced in JDK 1.1. Allows distributed Java programs to work with each others by behaving as if they are.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
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.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Remote Method Invocation
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.
DISTRIBUTED FILE SYSTEM USING RMI
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)
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Java RMI RMI = Remote Method Invocation. Allows Java programs to invoke methods of remote objects. Only between Java programs. Several versions (JDK-1.1,
Internet Software Development Remote Method Invocation Paul Krause.
1 Java Programming II Java Network II (Distributed Objects in Java)
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
+ A Short Java RMI Tutorial Usman Saleem
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Java RMI: Remote Method Invocation January 2000 Nancy McCracken Syracuse University.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
RMI RMI is the java API that facilitate distributed computing by allowing remote method calls. A remote method call represents a method invocation between.
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.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
 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.
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.
Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
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.
Java RMI. RMI Any object whose methods can be invoked from another Java VM is called a remote object.
Khoa CNTT 1/37 PHẠM VĂN TÍNH   Java 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.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Distributed programming in Java Faculty:Nguyen Ngoc Tu Session 5 - RMI.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
Netprog Java RMI1 Remote Method Invocation.
RMI1 Remote Method Invocation Adapted from “Core Java 2” by Cay Horstmann.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
Java Distributed Computing
Java Distributed Object System
Java Distributed Computing
Java Remote Method Invocation (RMI)
Remote Method Invocation
What is RMI? Remote Method Invocation
Remote Method Invocation
Java RMI (more) CS-328 Internet Programming.
Chapter 40 Remote Method Invocation
Remote Method Invocation
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
CS 584 Lecture 18 Assignment Glenda assignment extended to the Java RMI Deadline No Java RMI Assignment Test Friday, Saturday, Monday.
Java Remote Method Invocation
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

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 that communicate between virtual machines RMI is a means of doing distributed computing RMI hides the underlying mechanism of transporting method arguments and return values across the network.

Example Server returns sum of two numbers Client calls the add() method of the server and passes two numbers We will need four files AddServerIntf.java AddServerImpl.java AddServer.java AddClient.java Java Complete Reference- Schildt Naughton

Remote Interface a remote interface is an interface that declares a set of methods that may be invoked from a remote Java virtual machine. Must extend java.rmi.Remote The interface java.rmi.Remote is a marker interface that defines no methods public interface Remote {} All methods must throw RemoteException

AddServerIntf.java import java.rmi.*; public interface AddServerIntf extends Remote { double add (double d1, double d2) throws RemoteException; }

RMI Registry Simple Name Repository Server binds a name with an object implementation Client can query the registry for checking the availability of a server object

AddServerImpl.java import java.rmi.*; import java.rmi.server.*; public class AddServerImpl extends UnicastRemoteObject implements AddServerIntf { public AddServerImpl() throws RemoteException{} public double add (double d1, double d2) throws RemoteException {return d1+d2;} }

Parameter Passing Passing by Copy Local objects and exceptions are passed by copy. Use JAVA object serialization Passing by Reference Remote Object Passed by reference

AddServer.java import java.rmi.*; public class AddServer { public static void main(String[] args) { try{ AddServerImpl addServerImpl=new AddServerImpl(); Naming.rebind("AddServer",addServerImpl); } catch(Exception e){System.out.println(e);} }

AddClient.java import java.rmi.*; public class AddClient { public static void main(String[] args) { try{ String addServerURL = "rmi://"+args[0]+"/AddServer"; AddServerIntf addServerIntf= (AddServerIntf)Naming.lookup(addServerURL); double d1=Double.valueOf(args[1]).doubleValue(); double d2=Double.valueOf(args[2]).doubleValue(); System.out.println("Sum= "+addServerIntf.add(d1,d2)); } catch(Exception e){System.out.println(e);} }

Stubs and Skeletons Stub resides on client Provides interface of the server Skeleton Resides on server Generate stubs and skeletons rmic AddServerImpl

RMI Sequence of Actions The RMI Server creates an instance of the 'Server Object' which extends UnicastRemoteObject The constructor for UnicastRemoteObject "exports" the Server Object. A TCP socket which is bound to an arbitrary port number is created and a thread is also created that listens for connections on that socket. The server registers the server object with the registry.

RMI Sequence of Actions A client obtains the stub by calling the registry, which hands it the stub directly. When the client issues a remote method invocation to the server, the stub class opens a socket to the server on the port specified in the stub itself, and Sends the RMI header information as described in the RMI spec.

RMI Sequence of Actions The stub class marshalls the arguments On the server side, when a client connects to the server socket, a new thread is forked to deal with the incoming call. The server calls the "dispatch" method of the skeleton class, which calls the appropriate method on the object and pushes the result back down the wire

RMI Performance RMI vs. Local call(200Mhz, NT, JDK no JIT) Call time (no configuration available) setup time: RMI 40% slower than CORBA binding: RMI ms slower than CORBA CORBA vs. RMI 1000 calls, one argument, JDK1.1.1 Pengwu97

Resources java.sun.com ls.html ls.html csag.ucsd.edu/individual/achien/cs491- f97/reading.html[pengwu97] csag.ucsd.edu/individual/achien/cs491- f97/reading.html Java Complete Reference-Schildt Naughton