+ A Short Java RMI Tutorial Usman Saleem

Slides:



Advertisements
Similar presentations
Building Distributed Applications using JAVA - RMI
Advertisements

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.
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
1 HANDOUT 14 Remote Method Invocation (RMI) BY GEORGE KOUTSOGIANNAKIS THIS DOCUMENT CAN NOT BE REPRODUCED OR DISTRIBUTED WITHOUT TH E WRITTEN PERMISSION.
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.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Internet Software Development Remote Method Invocation Paul Krause.
1 Java Programming II Java Network II (Distributed Objects in Java)
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.
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.
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.
Remote Method Invocation onlineTraining/rmi/RMI.html.
RMI Continued IS Outline  Review of RMI  Programming example.
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.
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.
1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation.
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
Chapter 4 Remote Method Invocation
Java Distributed Computing
Java Remote Method Invocation (RMI)
Remote Method Invocation
Java RMI CS-328 Internet Programming.
What is RMI? Remote Method Invocation
Remote Method Invocation
Network and Distributed Programming in Java
Creating a Distributed System with RMI
Creating a Distributed System with RMI
Remote method invocation (RMI)
Overview of RMI Architecture
Remote Method Invocation
Creating a Distributed System with RMI
Java Remote Method Invocation
Creating a Distributed System with RMI
Overview of RMI Architecture
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

+ A Short Java RMI Tutorial Usman Saleem

+ Agenda Introducing RMI The RMI classes and interfaces The General RMI Architecture Demo – build up 4 required classes Demo – compiling and running the Weather Server 2

+ Introducing RMI An RMI application is often composed of two separate programs, a server and a client. The server creates remotes objects and makes references to those objects accessible. Then it waits for clients to invoke methods on the objects. The client gets remote references to remote objects in the server and invokes methods on those remote objects. Users use object as though it were a regular, local object Network connections happen automatically behind the scenes Java ‘serialization’ lets you pass complex data structures over the network without writing code to parse and reconstruct them 3

+ Introducing RMI (cont.) A distributed object application has to handle the following properties: Locate remote objects Communicate with remote objects Load class bytecodes for objects that are passed as parameters or return values 4

+ Interfaces and Classes in the java.rmi package 5

+ The RMI classes and interfaces 6

+ The General RMI Architecture 7

+ Remote object interface implemenation 8

+ RMI Architecture 9 *RRL: Remote Reference Layer

+ Runtime Architecture 10

+ Stub and Skeleton Initiates a connection with remote JVM containing the remote object Marshals (writes and transmits) parameters to remote JVM Wait for the result of method invocation Unmarshals (reads) the return value or exception returned Return the value to the caller Unmarshals (reads) the parameters for the remote method Invokes the method on the actual remote method implementation Marshals (write and transmit) the result (return value or exception) to the caller. Stub OperationSkeleton Operation 11

+ Stub and Skeleton (Cont.) In Java 2 SDK, Standard Edition, v1.2 an additional stub protocol was introduced that eliminates the need for skeletons in Java 2 platform-only environment. Instead, generic code is used to carry out the duties performed by the skeletons in JDK

+ Demo – build up 4 required classes 13

+ Class Diagram – four required classes

+ The interface for remote object 15 The remote interface must satisfy the following conditions: It must extend the interface Remote. Each remote method declaration in the remote interface must throw RemoteException

+ The remote object implementation The class must extend UnicastRemoteObject and implement the remote object interface The constructor should throw RemoteException 16

+ The remote object implementation 17

+ The RMI Server Start RMI Registry through code (It can also run from command line) Create instance of remote object Export remote object if it does not extends from UnicastRemoteObject Bind remote object using Naming.bind(throw AlreadyBoundException if a previous binding exists) or Naming.rebind (replace any previous bindings) 18

+ The RMI Server 19

+ The RMI Client Lookup the object from the host using Naming.lookup, cast it to any appropriate type, then use it like a local object 20

+ The RMI Client 21

+ Demo – compiling and running the CrickInfo Server 22

+ Compiling CrickInfo Server 1. Call rmic to create stubs of remote object (skeletons are optional in JDK 1.2 and above) 23

+ Compiling and running the CrickInfo Server and Client 3. startup the server 4. start the client 24