Lecture 5: RMI etc. Servant. Java Remote Method Invocation Invocation Semantics Distributed Events CDK: Chapter 5 TVS: Section 8.3

Similar documents
Lecture 5: Object Interaction: RMI and RPC

Chapter 5: Distributed objects and remote invocation

Lecture 06: Distributed Object

MODELS OF DISTRIBUTED SYSTEMS

Distributed Systems. 5. Remote Method Invocation

C 1. Recap: Finger Table. CSE 486/586 Distributed Systems Remote Procedure Call. Chord: Node Joins and Leaves. Recall? Socket API

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Distributed Information Systems

The UNIVERSITY of EDINBURGH. SCHOOL of INFORMATICS. CS4/MSc. Distributed Systems. Björn Franke. Room 2414

MODELS OF DISTRIBUTED SYSTEMS

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

Remote Invocation. 1. Introduction 2. Remote Method Invocation (RMI) 3. RMI Invocation Semantics

COMMUNICATION IN DISTRIBUTED SYSTEMS

RMI: Design & Implementation

Distributed Systems Lecture 2 1. External Data Representation and Marshalling (Sec. 4.3) Request reply protocol (failure modes) (Sec. 4.

CHAPTER - 4 REMOTE COMMUNICATION


Chapter 5 Distributed Objects and Remote Invocation

Distributed Systems. The main method of distributed object communication is with remote method invocation

Structured communication (Remote invocation)

03 Remote invoaction. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2)

5.4. Events and notifications

Applications. RMI, RPC and events. Request reply protocol External data representation. Operating System

Remote Objects and RMI

Chapter 5: Remote Invocation. Copyright 2015 Prof. Amr El-Kadi

Modulo II Socket, RMI e Corba

Q.1. (a) [4 marks] List and briefly explain four reasons why resource sharing is beneficial.

JAVA RMI. Remote Method Invocation

3. Remote Procedure Call

CSci Introduction to Distributed Systems. Communication: RPC

Last Class: RPCs. Today:

RPC and RMI. 2501ICT Nathan

CS 5523 Operating Systems: Remote Objects and RMI

Remote Method Invocation

Today: Distributed Objects. Distributed Objects

A Report on RMI and RPC Submitted by Sudharshan Reddy B

Distributed Systems. 6. Remote Method Invocation. Werner Nutt

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Outline. Interprocess Communication. Interprocess Communication. Communication Models: Message Passing and shared Memory.

Java RMI Middleware Project

Object-Oriented Systems Design RMI

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

Chapter 5 Remote Invocation. Gandeva Bayu Satrya, ST., MT. Telematics Labz. Informatics Department Telkom

5 Distributed Objects: The Java Approach

Message Passing vs. Distributed Objects. 5/15/2009 Distributed Computing, M. L. Liu 1

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A

Distributed Information Processing

Generic architecture

Networked Systems and Services, Fall 2018 Chapter 4. Jussi Kangasharju Markku Kojo Lea Kutvonen

Last Class: RPCs. Today:

Distributed Systems Principles and Paradigms. Distributed Object-Based Systems. Remote distributed objects. Remote distributed objects

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Slides for Chapter 5: Remote Invocation

IBD Intergiciels et Bases de Données

Distributed Systems Recitation 3. Tamim Jabban

416 Distributed Systems. RPC Day 2 Jan 11, 2017

15-498: Distributed Systems Project #1: Design and Implementation of a RMI Facility for Java

Distributed Objects SPL/ SPL 201 / 0 1

Distributed Systems Theory 4. Remote Procedure Call. October 17, 2008

RMI & RPC. CS 475, Spring 2019 Concurrent & Distributed Systems

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

416 Distributed Systems. RPC Day 2 Jan 12, 2018

Remote Invocation Vladimir Vlassov and Johan Montelius

Lecture 14: Distributed File Systems. Contents. Basic File Service Architecture. CDK: Chapter 8 TVS: Chapter 11

KTH ROYAL INSTITUTE OF TECHNOLOGY. Remote Invocation. Vladimir Vlassov and Johan Montelius

Distributed object component middleware I - Java RMI

Chapter 15: Distributed Communication. Sockets Remote Procedure Calls (RPCs) Remote Method Invocation (RMI) CORBA Object Registration

Distributed object component middleware I - Java RMI

Lecture VI: Distributed Objects. Remote Method Invocation

Remote Procedure Calls

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4

CSCI-1680 RPC and Data Representation. Rodrigo Fonseca

Remote Procedure Call

Programming with RMI Reminder

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

DISTRIBUTED SYSTEMS [COMP9243] Distributed Object based: Lecture 7: Middleware. Slide 1. Slide 3. Message-oriented: MIDDLEWARE

CS 403/534 Distributed Systems Midterm April 29, 2004

Written by: Dave Matuszek

Verteilte Systeme (Distributed Systems)

Communication Paradigms

Distributed Middleware. Distributed Objects

Remote Invocation. Today. Next time. l Indirect communication. l Request-reply, RPC, RMI

Object-Oriented Distributed Technology

Distributed Systems. Distributed Object Systems 2 Java RMI. Java RMI. Example. Applet continued. Applet. slides2.pdf Sep 9,

Remote Invocation. To do. Request-reply, RPC, RMI. q Today q. q Next time: Indirect communication

RMI. Remote Method Invocation. 16-Dec-16

CSCI-1680 RPC and Data Representation. Rodrigo Fonseca

Distributed Systems 8. Remote Procedure Calls

Distributed Programming with RMI. Overview CORBA DCOM. Prepared By: Shiba R. Tamrakar

03 Remote invocation. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI

Distributed Programming in Java. Distribution (2)

Remote Method Invocation in Java

Electronic Payment Systems (1) E-cash

Remote Procedure Call. Tom Anderson

Remote Procedure Call (RPC) and Transparency

Grid Computing. Java Remote Method Invocation (RMI) RMI Application. Grid Computing Fall 2006 Paul A. Farrell 9/5/2006

Interprocess Communication Tanenbaum, van Steen: Ch2 (Ch3) CoDoKi: Ch2, Ch3, Ch5

CAS 703 Software Design

Transcription:

Lecture 5: RMI etc. Java Remote Method Invocation Invocation Semantics Distributed Events CDK: Chapter 5 TVS: Section 8.3 CDK Figure 5.7 The role of proxy and skeleton in remote method invocation client object A proxy for B Request Reply server remote skeleton object B & dispatcher for B s class Remote Communication reference module module servant Communication Remote reference module module 14-Feb-11 COMP28112 Lecture 5 2 Servant An instance of a class which is referenced remotely It exists within the server, which created it and the remote reference to it It does the real work of the method 14-Feb-11 COMP28112 Lecture 5 3 1

The Dispatcher Server has a dispatcher & a skeleton for each class of remote object The dispatcher receives the incoming message, and uses its method info to pass it to the right method in the skeleton. (Dispatcher and proxy both work from the remote interface to get same method info!) 14-Feb-11 COMP28112 Lecture 5 4 Skeleton Skeleton implements methods of the remote interface to unmarshall arguments and invoke the corresponding method in the servant. It then marshalls the result (or any exceptions thrown) into a reply message to the proxy. 14-Feb-11 COMP28112 Lecture 5 5 Remote Reference Module Responsible for translating between remote references and local ones Has a remote object table, recording: An entry for each remote object local to that process (each process has its own table!) An entry for each local proxy Kept up-to-date appropriately 14-Feb-11 COMP28112 Lecture 5 6 2

Proxy There is one proxy per remote object a process can reference The class of the proxy contains a method for each method in the remote interface which marshalls arguments and unmarshalls results for that method. 14-Feb-11 COMP28112 Lecture 5 7 Garbage Collection of Remote Objects Once references to objects can be remote, Garbage Collection is more difficult Garbage Collection is done locally to the process but remote objects are not removed Each server keeps a set of clients with nonlocal references Each client tells server when removing proxy 14-Feb-11 COMP28112 Lecture 5 8 Generating classes for proxies, dispatchers and skeletons Before JDK1.5, there was a separate tool to use to generate these: rmic With JDK1.5 (and later) you don t need to do this It is done using reflection That can also simplify other things. 14-Feb-11 COMP28112 Lecture 5 9 3

Reflection in Java Reflection allows a Java program to inspect and manipulate itself It can get an object representing a class whose name is a String It can then find out about this class s constructors, and methods, and their arguments 14-Feb-11 COMP28112 Lecture 5 10 Reflection continued It can then invoke these to construct objects and call their methods E.g. Class c = Class.forname( MyExClass ); Constructors [] cc = c.getdeclaredconstructors() ; etc. 14-Feb-11 COMP28112 Lecture 5 11 rmiregistry This is how a server makes a remote object available to clients A string is bound to the remote object, and the clients interrogate the registry using the string The client must know the server machine name and the port the registry is on (there is a default) 14-Feb-11 COMP28112 Lecture 5 12 4

Invocation Semantics This applies to both RPC and RMI For both normal method invocation and normal procedure call, we have exactly once semantics So what can we say in a distributed system where machines can crash and messages can be lost? 14-Feb-11 COMP28112 Lecture 5 13 Failures Request could be lost Reply could be lost Server could fail Client could fail 14-Feb-11 COMP28112 Lecture 5 14 Request Behaviour What does client do if it makes a request, but gets no reply (after long enough)? It could just fail (not usual behaviour) It could resend the request If after several resends, still no reply -> failure 14-Feb-11 COMP28112 Lecture 5 15 5

Reply Behaviour What should the server do on getting a request? If it doesn t know it is a duplicate, it just processes it (perhaps again) It could filter duplicates if it remembers requests, and then: Discard duplicate if it hasn t yet replied It could retransmit the reply (if it remembers it) 14-Feb-11 COMP28112 Lecture 5 16 CDK Figure 5.6 Invocation semantics Fault tolerance measures Invocation semantics Retransmit request message Duplicate filtering Re-execute procedure or retransmit reply No Not applicable Not applicable Maybe Yes No Re-execute procedure At-least-once Yes Yes Retransmit reply At-most-once 14-Feb-11 COMP28112 Lecture 5 17 Maybe semantics The invocation may or may not happen It is less effort but not generally satisfactory 14-Feb-11 COMP28112 Lecture 5 18 6

At-least-once semantics Unless the server crashes, this means that the invocation definitely happens But it might happen more than once! OK for idempotent operations, ones which Can be performed >1 time with no different effect to that when performed once Sun RPC does this 14-Feb-11 COMP28112 Lecture 5 19 At-most-once semantics Requires extra effort Operation won t be done more than once! Java RMI provides this 14-Feb-11 COMP28112 Lecture 5 20 Distributed Event-based Systems You can build a distributed application using RPC or RMI in a normal way Distributed event-based systems show another possibility Events are notified to those objects which subscribe to (i.e. register interest in) an object 14-Feb-11 COMP28112 Lecture 5 21 7

Events are Published There is a way in which objects which are prepared to notify events to subscribers can make these known s are sent asynchronously to all subscribers 14-Feb-11 COMP28112 Lecture 5 22 Dealing room system Dealer s computer External source Dealer s computer Dealer Dealer Information provider Dealer s computer Dealer Information provider External source Dealer s computer Dealer 14-Feb-11 COMP28112 Lecture 5 23 Next Lecture I will talk about the 2 nd lab exercise This starts next week, and will occupy 3 sessions! 14-Feb-11 COMP28112 Lecture 5 24 8