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)

Slides:



Advertisements
Similar presentations
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Advertisements

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
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.
Remote Method Invocation
Remote Object Invocation
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.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
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
CSE331: Introduction to Networks and Security Lecture 11 Fall 2002.
Introduction to Remote Method Invocation (RMI)
Java RMI Essentials Based on Mastering RMI Rickard Oberg.
+ 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.
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.
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.
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 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.
 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.
Remote Method Invocation by James Hunt, Joel Dominic, and Adam Mcculloch.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation.
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.
Computer Science Lecture 4, page 1 CS677: Distributed OS Last Class: RPCs RPCs make distributed computations look like local computations Issues: –Parameter.
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.
Remote Method Invocation Internet Computing Workshop Lecture 17.
Java Distributed Computing
Chapter 4 Remote Method Invocation
Java Distributed Computing
RMI Packages Overview java.rmi java.rmi.server java.rmi.registry
Remote Method Invocation
What is RMI? Remote Method Invocation
Remote Method Invocation
Network and Distributed Programming in Java
Programming Models for Distributed Application
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Creating a Distributed System with RMI
Chapter 40 Remote Method Invocation
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
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
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
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:

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) u idea: allow programs to treat remote objects just like local objects –remote references –remote invocation

COS 461 Fall 1997 Remote References u naming a remote object (“global address”) –machine (IP address) –port number –(boot time) –unique object ID number u works in protocol, but not for a Java program u for program, use stand-in proxy object

COS 461 Fall 1997 Proxy Objects proxyobject globalAddr real object programprogram

COS 461 Fall 1997 Proxy Objects u separate proxy object for each remote object that is referenced u proxy object looks just like real object –implements the same Java interface u proxy’s methods do RPC to real object –handle arguments, return values, exceptions correctly u proxy code generated by RMI compiler

COS 461 Fall 1997 Proxy Types u remote objects declared as having an interface type –no variables, only methods u proxy implements same interface as real object u remote interface types must extend java.rmi.Remote interface

COS 461 Fall 1997 Proxy Table u each process keeps a table of all proxy objects –maps global address to proxy object u use table to maintain one-to-one mapping from proxy object to remote object u interactions with garbage collection (later)

COS 461 Fall 1997 Remote Invocation u when a proxy method is invoked: –invocation message sent to remote process »contains global address of object, method ID, arguments –remote process invokes real object –return message sent back to proxy object »contains return value or exception –proxy method call returns correct value, or throws correct exception

COS 461 Fall 1997 RMI Service Code u runs in each process that exports objects u waits for incoming connections u accepts requests, passes them to per-class request handlers u request handler translates global address to local reference, calls method, gets return value or catches exception, sends reply u request handler code generated by RMI compiler

COS 461 Fall 1997 Passing Arguments u primitive types (int, boolean, etc.) and ordinary objects passed by copy u Remote objects passed by reference –send across global address –at destination, translate into »pointer to existing proxy object, if there is one »pointer to new proxy object, otherwise u remaining question: how to copy objects

COS 461 Fall 1997 Passing a Remote Reference (1) real object proxy object globalAddr proxy object globalAddr

COS 461 Fall 1997 Passing a Remote Reference (2) proxy object globalAddr real object

COS 461 Fall 1997 Copying Objects u use ObjectOutputStream, ObjectInputStream u write out fields one at a time u if field is an Object type, recurse two tricky cases

COS 461 Fall 1997 Copying Objects u output stream is a sequence of objects –sequence number on each object in stream u to send a reference to an object, send the corresponding sequence number u keep table mapping pointer to sequence number –add entries when new objects are sent

COS 461 Fall 1997 Example (1) [int] 42 [boolean] true [T] [int] 0 [boolean] false [T] null [T] [class] <code for T> [int] [boolean] 1 [reference] 2 [class] <code for T> [int] [boolean] 0 [null]

COS 461 Fall 1997 Example (2) [int] 42 [boolean] true [T] [U] [class] <code for T> [int] [boolean] 1 [reference] 2 [class] <code for U> [reference] 1

COS 461 Fall 1997 Example (3) [int] 42 [boolean] true [T] [U] [class] [int] [boolean] 1 [reference] 2 [class] [reference] 1 [T] [U] [class] <code for U> [reference] 1

COS 461 Fall 1997 Class Codes u two parts to class code –“unique” ID number »hash of class name, variable names and types, method names and signature –URL of Java bytecode for class »allows recipient to load code, if it wants u (possible security problem)

COS 461 Fall 1997 Java Serialization u generalizes argument-passing to allow any object to be turned into a byte-array, and vice versa u to use, declare object as implementing Serializable u details –“transient” fields ignored –can customize serialization/deserialization –versioning support

COS 461 Fall 1997 Dealing with Failure u What if net fails, or object’s owner crashes? –proxy object detects failure –proxy throws RemoteException

COS 461 Fall 1997 Using RMI u write interface (extends Remote) u write server class (extends UnicastRemoteObject, implements interface) u run stub compiler (rmic) on server class –creates glue classes, one for each side u write code that uses class, compile and run

COS 461 Fall 1997 Garbage Collection u ideal situation: extend Java’s garbage collector to “do the right thing” in the distributed case –very difficult and inefficient in practice u lesser goal: collect everything, except for non-local cycles of garbage

COS 461 Fall 1997 Garbage Collection u collecting proxy objects –when no more local references to proxy, garbage-collect proxy »done “automatically” by existing garbage-collector –afterward, inform remote object that we don’t hold a proxy any more

COS 461 Fall 1997 Garbage Collection u collecting remote objects –RMI support code keeps track of who has proxies to the object –support code pings proxies periodically to make sure they’re still alive –support code keeps a reference to the object as long as there are any proxies –existing garbage-collector unmodified

COS 461 Fall 1997 Finding Objects u Where do remote references come from? –passed or returned by remote calls u Where does the first one come from? –special “registry” object on each host –special call to get a reference to a Registry object »uses a hack

COS 461 Fall 1997 Security? u short answer: questionable u long answer –messages not encrypted or signed »modification of calls »unauthorized calls »corruption of garbage-collection algorithm –serialization allows illegal object tampering u challenging to fix!