Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma. Distributed and Agent Systems RMI

Size: px
Start display at page:

Download "Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma. Distributed and Agent Systems RMI"

Transcription

1 Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma Distributed and Agent Systems RMI Prof. Agostino Poggi

2 What is RMI? Its acronym means Remote Method Invocation Supports communication between different Java virtual machines, potentially across the network Allows an object running in one Java virtual machine to invoke methods on an object running in another Java virtual machine Uses the same syntax and semantics used for non-distributed programs 2

3 RMI Features Locate remote objects Applications either can obtain references to remote objects from a naming facility, the RMI registry, or can pass and return remote object references as part of other remote invocations Communicate with remote objects Details of communication handled by RMI To the programmer, remote communication looks similar to regular Java method invocations Load class definitions for remote objects RMI provides mechanisms for loading an object's class definitions as well as for transmitting an object's data 3

4 Remote Interface RMI does not have a separate IDL RMI is used between Java virtual machines Java already includes the concept of interfaces An Interface to be a remote interfaces needs to extend the interface Java.rmi.Remote All methods in a remote interface must be declared to throw the java.rmi.remoteexception exception 4

5 Remote Class A class to be a remote class needs to implement a remote interface Most often a remote class also extends the library class java.rmi.server.unicastremoteobject This class includes a constructor that exports the object to the RMI system when it is created, thus making the object visible to the outside world A common convention is to name the remote class appending Impl to the name of the corresponding remote interface 5

6 Remote Method A client can request the execution of all those methods that are declared inside a remote interface A client request can contain some parameters Parameters can be of three types: Atomic types Objects Remote objects 6

7 Parameter Passing Atomic Type Local Object Remote Object Local Call Call by Value Call by Reference Call by Reference Remote Call Call by Value Call by Value Call by Reference 7

8 Serialization Take any object and turns it into a sequence of bytes that can be stored into a file and later can be fully restored into the original object A serializable object either must implement the java.io.serializable interface or must extend a class that extends it Primitive data are serializable, but static and transient data are not serialized Static data are not in the object state Transient data are data of which serialization is not wanted 8

9 Serialization public class ProductDescription implements Serializable { public static int counter; private string name; private float price; private transient Image image; private Geometry geo; } Geometry must be serializable 9

10 Write an Object Create a file to store the object OutputStream os = new FileOutputStream( c:\myclass ); Create ObjectOutputStream ObjectOutputStream oos = new ObjectOutputStream(os); Write object into the file MyClass instance = new MyClass();. oos.writeobject(instance); Close file and ObjectOutputStream oos.close(); os.close(); 10

11 Read an Object Open the file that stores the object InputStream is = new FileInputStream( c:\myclass ); Create ObjectInputStream ObjectInputStrem ois = new ObjectInputStream(is); Read the object into the file MyClass instance = (MyClass) ois.readobject(); Close file and ObjectOutputStream ois.close(); is.close(); 11

12 Reflection Reflection enables Java code to: Discover information about the fields, methods and constructors of loaded classes Use reflected fields, methods, and constructors to operate on the corresponding class instances RMI uses reflection for the execution of a remote call 12

13 java.lang.class Get a class Class c = Class.forName( class qualified name") ; Get its interfaces and superclass Class[] is = c.getinterfaces(); Class s = c.getsuperclass(); Get its public constructors Constructor[] cs = c.getconstructors(); Get its (public and inherited) fields and methods Field[] fs = c.getfields(); Method[] ms = c.getmethods(); Create an instance c.newinstance(); 13

14 java.lang.constructor Get its name String n = c.getname(); Get the classes declaring the constructor Class[] cs = c.getdeclaringclass(); Get its modifiers int[] ms = c.getmodifiers(); // see java.lang.reflect.modifier Get its parameter types Class[] ps = c.getparametertypes(); Create a class instance Object[] args = new Object[] { } ; c.newinstance(args); 14

15 java.lang.field Get itsname String n= f.getname(); Get its type Class c = f.gettype(); Get the classes declaring the field Class[] cs = t.getdeclaringclass(); Get its modifiers int[] ms = t.getmodifiers(); // see java.lang.reflect.modifier Get and set its value (v) for an object (o) Object v = f.get(o) ; // getboolean, getint, f.set(o, v); // setboolean, setint, 15

16 java.lang.method Get its name String n = m.getname(); Get the classes declaring the method Class[] cs = m.getdeclaringclass(); Get its modifiers int[] ms = m.getmodifiers(); // see java.lang.reflect.modifier Get its parameter types Class[] ps = m.getparametertypes(); Class[] r = m.getreturntype(); Get the method of an object (o) Object[] args = new Object[] { } ; c.invoke(o, args); 16

17 Application Components Stub makes RMI transparent to clients by behaving like a local object Communication module implements the request reply protocol Dispatcher receives request message from communication module and select the method in the skeleton Request Reply Servant Client Server Remote reference module translates between local and remote object references and creates remote object references Skeleton implements the remote interface of the servant 17

18 Remote Call Execution Stub has to marshal information about a method and its arguments into a request message An object of class Method An array of objects for the method s arguments The dispatcher Obtains the remote object reference Unmarshals the Method object and its arguments Calls the invoke method on the object reference and array of arguments values Marshals the result or any exceptions into the reply message 18

19 RMI Stack Client Server Stub Remote Reference Transport Skeleton Remote Reference Transport 19

20 Stub and Skeleton Layer Stub Marshals call parameters Sends them to the server Unmarshals return parameters Returns them to the client program Skeleton Reads the parameters for the method call from the link Makes the call to the remote service implementation object Accepts the return value Writes the return value back to the stub 20

21 Remote Reference Layer Client Side Knows if the remote object (still) exists Knows where to locate server holding the remote object Server Side Knows if the local object exists Knows where to locate the local implementation 21

22 Transport Layer Manages connection between Java Virtual Machines Used over the network and on the local host There is a messaging protocol implemented over TCP/IP 22

23 Application Components Registry Server Client Web Server 23

24 RMI Registry Runs on each machine, which hosts remote objects and accepts requests for services Allows registration operations and retrieval of remote objects Registration operation are only possible through servers running on the same machine of the registry Its default TCP/IP port is

25 java.rmi.registry.registry void bind (String name, Remote obj) Registers a remote object by name, but if the name is already in the registry an exception is thrown void rebind (String name, Remote obj) Registers the identifier of a remote object by name void unbind (String name, Remote obj) Removes a binding Remote lookup(string name) Looks up a remote object by name String [] list() Returns the names bound in the registry 25

26 java.rmi.registry.locateregistry Registry createregistry (int port) Creates and returns an embedded RMI registry listening on a specific port Registry getregistry () Returns a reference to a local registry running listening on the default registry port (1099) Registry getregistry (int port) Returns a reference to a local registry running listening on a specific port Registry getregistry (int port, String host) Returns a reference to a registry running on a specific host and listening on a specific port 26

27 Remote Object Binding Explicit by using registry methods Server binds/rebinds name with the rmiregistry Client looks up name with the rmiregistry Implicit by receiving a remote object reference 27

28 Remote Object Code import java.rmi.remote; import java.rmi.remoteexception; public interface MessageWriter extends Remote { void writemessage(string s) throws RemoteException; } import java.rmi.remoteexception; import java.rmi.server.unicastremoteobject; public class MessageWriterImpl extends UnicastRemoteObject implements MessageWriter { public MessageWriterImpl() throws RemoteException { } public void writemessage(string s) throws RemoteException { System.out.println(s); } } 28

29 Server Program Code import java.rmi.naming; creates a remote object public class HelloServer { public static void main(string [] args) throws Exception { MessageWriter service = new MessageWriterImpl(); MessageWriter stub = (MessageWriter) UnicastRemoteObject.exportObject(service); Registry registry = LocateRegistry.getRegistry(); registry.rebind( messagewriter, stub); } } Publishes a remote reference to that object with external name MessageWriter 29

30 Client Program Code import java.rmi.naming; Looks up a reference to a remote object with external name MessageWriter public class HelloClient { public static void main(string [] args) throws Exception { Registry registry = LocateRegistry.getRegistry(); MessageWriter service = (MessageWriter) registry.lookup( MessageWriter ); service.writemessage( Hello, other world ) ; } } Invokes the remote method writemessage on server 30

31 Compiling and Running javac *.java rmic MessageWriterImpl MessageWriterImp_Skel.class MessageWriterImp_Stub.class start rmiregistry java HelloServer java HelloClient 31

32 Distributed Garbage Collection In Java, unused objects are garbage collected Java Virtual Machine automatically destroys objects that are not referenced by anyone RMI implements a distributed garbage collector The aim of a distributed garbage collector are: Retain the local and remote objects when it is still be referenced Collect the objects when none holds reference to them RMI garbage collection algorithm is based on reference counting 32

33 Distributed Garbage Collection (2/2) Server Counts the number of remote references to each remote object it exports When there are no more local and remote references to the object, the object is destroyed Client should notify when it no longer uses remote references Each remote reference has an associated lease time Client renews the lease on the used references When all leases expire, the object can be destroyed Client must be prepared to deal with disappeared objects 33

34 Explicit Notification import java.rmi.server.unicastremoteobject; Import java.rmi.server.unreferenced; public class RemoteServerImpl extends UnicastRemoteObject implements MyRemoteInterface, Unreferenced { public RemoteServerImpl() { super();... //allocate resources }... public void unreferenced() { //deallocate resources here } } E.g., network and database connections can be released 34

35 Remote Class RMI can exchange objects through serialization, but serialized objects do not contain the code of the class they implement In fact, de-serialization process can be completed only if the client has available the code of the class to be de-serialized Class code can be provided by manually copy implementation class files to the client A more general approach is to publish implementation class files on a Web Server 35

36 Dynamic Class Loading Remote object's codebase is specified by setting the java.rmi.server.codebase property java Djava.rmi.server.codebase= HelloServer java Djava.rmi.server.codebase= HelloServer Client requests a reference to a remote object Registry returns a reference (the stub instance) to the requested class If the class definition for the stub instance is found locally in the client's CLASSPATH Then it loads the class definition Else it retrieves the class definition from the remote object's codebase 36

37 Security In Java a security manager checks if an untrusted code may have access to some system resources A policy defines which class has the right to do what depending on the class identity (i.e., its URL and its certificates) A protection domain is a set of permissions established by the current policy A security manager delegates all decisions to an access controller that decides according to: the permissions of the protection domain the checking of the sequence of call for resource grant/denial 37

38 Security in RMI Systems (1/2) Security is a serious concern since executable code is being downloaded from a remote location RMI normally allows the loading of code only from the local CLASSPATH RMI allows the loading of code from a remote location only if a suitable security manager is set and an appropriate security policy is defined RMI clients usually need to install security manager because they need to download stub files RMI servers usually do not need it, but it is still good practice to install it anyway 38

39 Security in RMI Systems (2/2) A security manager can be set as follows: System.setSecurityManager(new RMISecurityManager()) ; A security policy can be defined in a plain text file: grant codebase { permission java.security.allpermission }; grant codebase { permission java.security.allpermission }; And assigned to the client as follows: java Djava.security.policy=rmi.policy HelloClient 39

40 Activatable Objects Activatable objects are remote objects that are created and execute "on demand", rather than running all the time Activatable objects are important Remote objects could fail or could be shut down inadvertently or intentionally Remote objects use a set of resources for all their life even if they are used few times 40

41 Remote Object Code import java.rmi.remote; import java.rmi.remoteexception; public interface MessageWriter extends Remote { void writemessage(string s) throws RemoteException; } import java.rmi.remote; import java.rmi.activation.activatable; public class MessageWriterImpl extends Activatable implements MessageWriter { public MessageWriterImpl(ActivationID id, MarshalledObject data) throws RemoteException { super(id, 0); } public void writemessage(string s) throws RemoteException { System.out.println(s); } } 41

42 Setup Main Method Duties Install security manager for the ActivationGroup of the Java virtual machine. Set a security policy Create an ActivationGroupDesc instance Register it and get an ActivationGroupID Create an ActivationDesc instance Register it with rmid Bind or rebind the remote object instance with its name Exit the system 42

43 Setup Main Method Code public static void main(string[] args) throws Exception { System.setSecurityManager(new RMISecurityManager()); Properties props = new Properties(); props.put("java.security.policy", "/myrmi/rmi.policy"); ActivationGroupDesc.CommandEnvironment ace = null; ActivationGroupDesc eg = new ActivationGroupDesc(props, ace); ActivationGroupID agi = ActivationGroup.getSystem().registerGroup(eg); String location = "file:/myrmi/"; MarshalledObject data = null; ActivationDesc desc = new ActivationDesc(agi, MessageWriterImpl, location, data); MessageWriter server = (MessageWrite) Activatable.register(desc); Naming.rebind( messageservice, server); System.exit(0); } 43

44 Compiling and Running javac *.java rmic MessageWriterImpl start rmiregistry start rmid J-Djava.security.policy=rmi.policy java -Djava.security.policy=rmi.policy HelloSetup java -Djava.security.policy=rmi.policy HelloClient 44

45 Callbacks A callback server s action of notifying clients about an event implementation Improve performance by avoid constant polling Delivery information in a timely manner In a RMI based system callbacks are implements as follows: Client create a remote object Client pass the remote object reference to the server Whenever an event occurs, the server calls the client via the remote object 45

Java RMI Activation: A running example We have the following classes: MyRemoteInterface: the remote interface. Client: the client that invokes a

Java RMI Activation: A running example We have the following classes: MyRemoteInterface: the remote interface. Client: the client that invokes a Java RMI Activation: A running example We have the following classes: MyRemoteInterface: the remote interface. Client: the client that invokes a method on the remote object. ActivableImplementation: the

More information

Activation of remote objects

Activation of remote objects Activation of remote objects The Activatable class Prior to the release of Java 2 SDK, an instance of a UnicastRemoteObject could be accessed from a server program that created an instance of the remote

More information

Activation of remote objects

Activation of remote objects Activation of remote objects The Activatable class Prior to the release of Java 2 SDK, an instance of a UnicastRemoteObject could be accessed from a server program that created an instance of the remote

More information

JAVA RMI. Remote Method Invocation

JAVA RMI. Remote Method Invocation 1 JAVA RMI Remote Method Invocation 2 Overview Java RMI is a mechanism that allows one to invoke a method on an object that exists in another address space. The other address space could be: On the same

More information

Generic architecture

Generic architecture Java-RMI Lab Outline Let first builds a simple home-made framework This is useful to understand the main issues We see later how java-rmi works and how it solves the same issues Generic architecture object

More information

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

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2) Introduction Objective To support interoperability and portability of distributed OO applications by provision of enabling technology Object interaction vs RPC Java Remote Method Invocation (RMI) RMI Registry

More information

5.4. Events and notifications

5.4. Events and notifications 5.4. Events and notifications Distributed event-based systems extend local event model Allowing multiple objects at diff. locations to be notified of events taking place at an object Two characteristics:

More information

JAVA RMI Java, summer semester

JAVA RMI Java, summer semester JAVA RMI Overview Remote Method Invocation usage of remote object objects in a different VM (on the same computer or over the network) as there would be local objects (almost) calls just take longer time

More information

SUMMARY INTRODUCTION REMOTE METHOD INVOCATION

SUMMARY INTRODUCTION REMOTE METHOD INVOCATION SUMMARY REMOTE METHOD INVOCATION PROGRAMMAZIONE CONCORRENTE E DISTR. Università degli Studi di Padova Dipartimento di Matematica Corso di Laurea in Informatica, A.A. 2015 2016 rcardin@math.unipd.it Introduction

More information

RMI. (Remote Method Invocation)

RMI. (Remote Method Invocation) RMI (Remote Method Invocation) Topics What is RMI? Why RMI? Architectural components Serialization & Marshaled Objects Dynamic class loading Code movement Codebase ClassLoader delegation RMI Security Writing

More information

Remote Method Invocation

Remote Method Invocation Remote Method Invocation A true distributed computing application interface for Java, written to provide easy access to objects existing on remote virtual machines Provide access to objects existing on

More information

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

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University CS 555: DISTRIBUTED SYSTEMS [RMI] Frequently asked questions from the previous class survey Shrideep Pallickara Computer Science Colorado State University L21.1 L21.2 Topics covered in this lecture RMI

More information

RMI (Remote Method Invocation) Over the year, there have been 3 different approaches to application development:

RMI (Remote Method Invocation) Over the year, there have been 3 different approaches to application development: RMI (Remote Method Invocation) History: Over the year, there have been 3 different approaches to application development: 1. the traditional approach. 2. the client / server approach and 3. the component-

More information

Remote Objects and RMI

Remote Objects and RMI Outline Remote Objects and RMI Instructor: Dr. Tongping Liu Distributed/Remote Objects Remote object reference (ROR) Remote Method Invocation (RMI) Case study and example: Java RMI Other issues for objects

More information

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

DISTRIBUTED OBJECTS AND REMOTE INVOCATION DISTRIBUTED OBJECTS AND REMOTE INVOCATION Introduction This chapter is concerned with programming models for distributed applications... Familiar programming models have been extended to apply to distributed

More information

IBD Intergiciels et Bases de Données

IBD Intergiciels et Bases de Données IBD Intergiciels et Bases de Données RMI-based distributed systems Fabien Gaud, Fabien.Gaud@inrialpes.fr Overview of lectures and practical work Lectures Introduction to distributed systems and middleware

More information

CS 5523 Operating Systems: Remote Objects and RMI

CS 5523 Operating Systems: Remote Objects and RMI CS 5523 Operating Systems: Remote Objects and RMI Instructor: Dr. Tongping Liu Thank Dr. Dakai Zhu and Dr. Palden Lama for providing their slides. Outline Distributed/Remote Objects Remote object reference

More information

Distributed Systems. 02r. Java RMI Programming Tutorial. Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017

Distributed Systems. 02r. Java RMI Programming Tutorial. Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017 Distributed Systems 02r. Java RMI Programming Tutorial Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017 1 Java RMI RMI = Remote Method Invocation Allows a method to be invoked that resides

More information

RPC and RMI. 2501ICT Nathan

RPC and RMI. 2501ICT Nathan RPC and RMI 2501ICT Nathan Contents Client/Server revisited RPC Architecture XDR RMI Principles and Operation Case Studies Copyright 2002- René Hexel. 2 Client/Server Revisited Server Accepts commands

More information

RMI. Remote Method Invocation. 16-Dec-16

RMI. Remote Method Invocation. 16-Dec-16 RMI Remote Method Invocation 16-Dec-16 The network is the computer Consider the following program organization: method SomeClass call AnotherClass returned object computer 1 computer 2 If the network is

More information

Distributed object component middleware I - Java RMI

Distributed object component middleware I - Java RMI Prof. Dr. Claudia Müller-Birn Institute for Computer Science, Networked Information Systems Distributed object component middleware I - Java RMI Nov 15th, 2011 Netzprogrammierung (Algorithmen und Programmierung

More information

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

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A Contents Java RMI G53ACC Chris Greenhalgh Java RMI overview A Java RMI example Overview Walk-through Implementation notes Argument passing File requirements RPC issues and RMI Other problems with RMI 1

More information

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

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4 EEC-681/781 Distributed Computing Systems Lecture 4 Department of Electrical and Computer Engineering Cleveland State University wenbing@ieee.org Outline Inter-process communications Computer networks

More information

Distributed object component middleware I - Java RMI

Distributed object component middleware I - Java RMI Prof. Dr. Claudia Müller-Birn Institute for Computer Science, Networked Information Systems Distributed object component middleware I - Java RMI Nov 15th, 2011 Netzprogrammierung (Algorithmen und Programmierung

More information

Questions and Answers. A. RMI allows us to invoke a method of java object that executes on another machine.

Questions and Answers. A. RMI allows us to invoke a method of java object that executes on another machine. Q.1) What is Remote method invocation (RMI)? A. RMI allows us to invoke a method of java object that executes on another machine. B. RMI allows us to invoke a method of java object that executes on another

More information

Written by: Dave Matuszek

Written by: Dave Matuszek RMI Remote Method Invocation Written by: Dave Matuszek appeared originally at: http://www.cis.upenn.edu/~matuszek/cit597-2003/ 28-May-07 The network is the computer * Consider the following program organization:

More information

RMI Case Study. A Typical RMI Application

RMI Case Study. A Typical RMI Application RMI Case Study This example taken directly from the Java RMI tutorial http://java.sun.com/docs/books/tutorial/rmi/ Editorial note: Please do yourself a favor and work through the tutorial yourself If you

More information

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

The UNIVERSITY of EDINBURGH. SCHOOL of INFORMATICS. CS4/MSc. Distributed Systems. Björn Franke. Room 2414 The UNIVERSITY of EDINBURGH SCHOOL of INFORMATICS CS4/MSc Distributed Systems Björn Franke bfranke@inf.ed.ac.uk Room 2414 (Lecture 3: Remote Invocation and Distributed Objects, 28th September 2006) 1 Programming

More information

Distributed Systems. 5. Remote Method Invocation

Distributed Systems. 5. Remote Method Invocation Distributed Systems 5. Remote Method Invocation Werner Nutt 1 Remote Method Invocation 5.1 Communication between Distributed Objects 1. Communication between Distributed Objects 2. RMI 2 Middleware Middleware

More information

Lecture 18 Inside Java RMI

Lecture 18 Inside Java RMI CMSC 433 Fall 2014 Sec/on 0101 Mike Hicks (slides due to Rance Cleaveland) Lecture 18 Inside Java RMI Recall Java RMI applica/ons consist of three en//es Remote object servers Host remote objects Handle

More information

Distributed Objects SPL/ SPL 201 / 0 1

Distributed Objects SPL/ SPL 201 / 0 1 Distributed Objects 1 distributed objects objects which reside on different machines/ network architectures, benefits, drawbacks implementation of a remote object system 2 Why go distributed? large systems

More information

Distributed Systems. 6. Remote Method Invocation. Werner Nutt

Distributed Systems. 6. Remote Method Invocation. Werner Nutt Distributed Systems 6. Remote Method Invocation Werner Nutt 1 Remote Method Invocation 6.1 Communication between Distributed Objects 1. Communication between Distributed Objects 2. Java RMI 3. Dynamic

More information

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

Distributed Systems. Distributed Object Systems 2 Java RMI. Java RMI. Example. Applet continued. Applet. slides2.pdf Sep 9, Distributed Object Systems 2 Java RMI Piet van Oostrum Distributed Systems What should a distributed system provide? Illusion of one system while running on multiple systems Transparancy Issues Communication,

More information

How are classes loaded into the Java Virtual Machine (JVM)? from the local file system (CLASSPATH). by an instance of ClassLoader

How are classes loaded into the Java Virtual Machine (JVM)? from the local file system (CLASSPATH). by an instance of ClassLoader 36 ClassLoader How are classes loaded into the Java Virtual Machine (JVM)? from the local file system (CLASSPATH). by an instance of ClassLoader... and when? - When they are needed the first time. class

More information

Verteilte Systeme (Distributed Systems)

Verteilte Systeme (Distributed Systems) Verteilte Systeme (Distributed Systems) Karl M. Göschka Karl.Goeschka@tuwien.ac.at http://www.infosys.tuwien.ac.at/teaching/courses/ VerteilteSysteme/ Lecture 3: Communication (Part 2) Remote Procedure

More information

RMI Example RMI. CmpE 473 Internet Programming RMI

RMI Example RMI. CmpE 473 Internet Programming RMI CmpE 473 Internet Programming Pınar Yolum pinar.yolum@boun.edu.tr Department of Computer Engineering Boğaziçi University RMI Examples from Advanced Java: Internet Applications, Art Gittleman Remote Method

More information

Remote Method Invocation Benoît Garbinato

Remote Method Invocation Benoît Garbinato Remote Method Invocation Benoît Garbinato 1 Fundamental idea (1) Rely on the same programming paradigm for distributed applications as for centralized applications In procedural languages, we will rely

More information

Remote Method Invocation. Benoît Garbinato

Remote Method Invocation. Benoît Garbinato Remote Method Invocation Benoît Garbinato Fundamental idea (1) Rely on the same programming paradigm for distributed applications as for centralized applications In procedural languages, we will rely on

More information

Last Class: Network Overview. Today: Distributed Systems

Last Class: Network Overview. Today: Distributed Systems Last Class: Network Overview =>Processes in a distributed system all communicate via a message exchange. Physical reality: packets Abstraction: messages limited size arbitrary size unordered (sometimes)

More information

presentation DAD Distributed Applications Development Cristian Toma

presentation DAD Distributed Applications Development Cristian Toma Lecture 8 S4 - Core Distributed Middleware Programming in JEE presentation DAD Distributed Applications Development Cristian Toma D.I.C.E/D.E.I.C Department of Economic Informatics & Cybernetics www.dice.ase.ro

More information

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01 Introduction & RMI Basics CS3524 Distributed Systems Lecture 01 Distributed Information Systems Distributed System: A collection of autonomous computers linked by a network, with software to produce an

More information

A Typical RMI Application

A Typical RMI Application A Typical RMI Application Client and Server run on different machines Remote Object(s) registered in rmiregistry by Server Remote Object(s) look d up by Client When necessary, code transferred from web

More information

Chapter 5 Distributed Objects and Remote Invocation

Chapter 5 Distributed Objects and Remote Invocation CSD511 Distributed Systems 分散式系統 Chapter 5 Distributed Objects and Remote Invocation 吳俊興 國立高雄大學資訊工程學系 Chapter 5 Distributed Objects and Remote Invocation 5.1 Introduction 5.2 Communication between distributed

More information

Distributed Computing

Distributed Computing Distributed Computing Computing on many systems to solve one problem Why? - Combination of cheap processors often more cost-effective than one expensive fast system - Flexibility to add according to needs

More information

A Typical RMI Application. Case Study

A Typical RMI Application. Case Study A Typical RMI Application Client and Server run on different machines Remote Object(s) registered in rmiregistry by Server Remote Object(s) look d up by Client When necessary, code transferred from web

More information

Remote Method Invocation

Remote Method Invocation Non-101samples available here: https://github.com/101companies/101repo/tree/master/languages/aspectj/javarmisamples Remote Method Invocation Prof. Dr. Ralf Lämmel Universität Koblenz-Landau Software Languages

More information

Distributed Software Systems

Distributed Software Systems RMI Programming Distributed Software Systems RMI Programming RMI software Generated by IDL compiler Proxy Behaves like remote object to clients (invoker) Marshals arguments, forwards message to remote

More information

Distributed Programming in Java. Distribution (2)

Distributed Programming in Java. Distribution (2) Distributed Programming in Java Distribution (2) Remote Method Invocation Remote Method Invocation (RMI) Primary design goal for RMI is transparency Should be able to invoke remote objects with same syntax

More information

Lecture VI: Distributed Objects. Remote Method Invocation

Lecture VI: Distributed Objects. Remote Method Invocation Lecture VI: Distributed Objects. Remote Method Invocation CMPT 401 Summer 2007 Dr. Alexandra Fedorova Remote Method Invocation In an object-oriented language (usually Java) A way to call a method on an

More information

Distributed Systems COMP 212. Lecture 10 Othon Michail

Distributed Systems COMP 212. Lecture 10 Othon Michail Distributed Systems COMP 212 Lecture 10 Othon Michail RMI: Remote Method Invocation Allows an object running in one Java virtual machine to invoke methods on an object running in another Java virtual machine.

More information

CSci Introduction to Distributed Systems. Communication: RPC In Practice

CSci Introduction to Distributed Systems. Communication: RPC In Practice CSci 5105 Introduction to Distributed Systems Communication: RPC In Practice Linux RPC Language-neutral RPC Can use Fortran, C, C++ IDL compiler rpgen N to generate all stubs, skeletons (server stub) Example:

More information

55:182/22C:182. Distributed Application Frameworks Java RMI, CORBA, Web Services (SOAP)

55:182/22C:182. Distributed Application Frameworks Java RMI, CORBA, Web Services (SOAP) 55:182/22C:182 Distributed Application Frameworks Java RMI, CORBA, Web Services (SOAP) Broker Architecture Example Java Remote Method Invocation (RMI) Invoking a method which lies in a different address

More information

Desarrollo de Aplicaciones en Red RMI. Introduction. Considerations. Considerations. RMI architecture

Desarrollo de Aplicaciones en Red RMI. Introduction. Considerations. Considerations. RMI architecture session Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano RMI Remote Method Invocation Introduction Java RMI let s work calling remote methods. Underneath it works with

More information

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

03 Remote invocation. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI 03 Remote invocation Request-reply RPC Coulouris 5 Birrel_Nelson_84.pdf RMI 2/16 Remote Procedure Call Implementation client process Request server process client program client stub procedure Communication

More information

Java. Java. Java. Java. java. java. test.java. smalltalk. java. static. java virtual machine. java. C++ virtual

Java. Java. Java. Java. java. java. test.java. smalltalk. java. static. java virtual machine. java. C++ virtual Java Java C Constructordestructor C++ virtual interfacec++ Operator overloading Template Java C++java smalltalk java java virtual machine java Java test.java javac test.javatest.class java test test.classmain

More information

Java. Java. Java. Java. java. smalltalk. java. java virtual machine. java. C++ virtual. interface C++ Operator overloading Template C++ test.

Java. Java. Java. Java. java. smalltalk. java. java virtual machine. java. C++ virtual. interface C++ Operator overloading Template C++ test. Java Java C Constructordestructor C++ virtual interfacec++ Operator overloading Template C++ Java class C structpublicclass (inheritance) Multiple inheritance constructor (destructor) new / delete (virtual

More information

Remote Method Invocation

Remote Method Invocation Remote Method Invocation RMI Dr. Syed Imtiyaz Hassan Assistant Professor, Deptt. of CSE, Jamia Hamdard (Deemed to be University), New Delhi, India. s.imtiyaz@jamiahamdard.ac.in 1 Agenda Introduction Creating

More information

JAC444 - Lecture 11. Remote Method Invocation Segment 2 - Develop RMI Application. Jordan Anastasiade Java Programming Language Course

JAC444 - Lecture 11. Remote Method Invocation Segment 2 - Develop RMI Application. Jordan Anastasiade Java Programming Language Course JAC444 - Lecture 11 Remote Method Invocation Segment 2 - Develop RMI Application 1 Remote Method Invocation In this lesson you will be learning about: Designing RMI application Developing distributed object

More information

REMOTE METHOD INVOCATION INTRODUCTION TO RMI, A JAVA API FOR RPC-STYLE INVOCATION OF REMOTE OBJECT METHODS

REMOTE METHOD INVOCATION INTRODUCTION TO RMI, A JAVA API FOR RPC-STYLE INVOCATION OF REMOTE OBJECT METHODS RMI Remote Method RMI Invocation REMOTE METHOD INVOCATION INTRODUCTION TO RMI, A JAVA API FOR RPC-STYLE INVOCATION OF REMOTE OBJECT METHODS Peter R. Egli 1/19 Contents 1. What is RMI? 2. Important RMI

More information

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

Applications. RMI, RPC and events. Request reply protocol External data representation. Operating System Figure 5.1 Middleware layer Applications RMI, RPC and events Request reply protocol External data representation Middleware layers Operating System Instructor s Guide for Coulouris, Dollimore and Kindberg

More information

Remote Procedure Call

Remote Procedure Call Remote Procedure Call Suited for Client-Server structure. Combines aspects of monitors and synchronous message passing: Module (remote object) exports operations, invoked with call. call blocks (delays

More information

Info 408 Distributed Applications programming 2 nd semester of Credits: 5 Lecturer: Antoun Yaacoub Ph.D.

Info 408 Distributed Applications programming 2 nd semester of Credits: 5 Lecturer: Antoun Yaacoub Ph.D. Lebanese University Faculty of Sciences I Master 1 degree Computer Sciences Info 408 Distributed Applications programming 2 nd semester of 2018-2019 Credits: 5 Lecturer: Antoun Yaacoub Ph.D. RMI Serialization

More information

Modulo II Socket, RMI e Corba

Modulo II Socket, RMI e Corba Modulo II Socket, RMI e Corba Prof. Ismael H F Santos April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Ementa Sistemas Distribuídos Cliente-Servidor April 05 Prof. Ismael H. F. Santos -

More information

COMP 6231: Distributed System Design

COMP 6231: Distributed System Design COMP 6231: Distributed System Design Remote Invocation and RMI Based on Chapters 5, 7 of the text book and the slides from Prof. M.L. Liu, California Polytechnic State University COMP 6231, Fall 2013 Remote

More information

Course Snapshot. The Next Few Classes. Parallel versus Distributed Systems. Distributed Systems. We have covered all the fundamental OS components:

Course Snapshot. The Next Few Classes. Parallel versus Distributed Systems. Distributed Systems. We have covered all the fundamental OS components: Course Snapshot The Next Few Classes We have covered all the fundamental OS components: Architecture and OS interactions Processes and threads Synchronization and deadlock Process scheduling Memory management

More information

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

Grid Computing. Java Remote Method Invocation (RMI) RMI Application. Grid Computing Fall 2006 Paul A. Farrell 9/5/2006 Grid Computing Paradigms for Distributed Computing 2 RMI Fall 2006 Traditional paradigms for distributed computing The Grid: Core Technologies Maozhen Li, Mark Baker John Wiley & Sons; 2005, ISBN 0-470-09417-6

More information

Course Snapshot. The Next Few Classes

Course Snapshot. The Next Few Classes Course Snapshot We have covered all the fundamental OS components: Architecture and OS interactions Processes and threads Synchronization and deadlock Process scheduling Memory management File systems

More information

Chapter 4: Processes. Process Concept. Process State

Chapter 4: Processes. Process Concept. Process State Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Process Concept An operating

More information

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

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 4.3 Remote procedure calls RPC flow Client process Server process Program i = sum (3,7); Procedure sum (j,k) int j,k; {return j+k; Client stub Program Return Call Unpack Pack result para s Invisible to

More information

Communication Basics, RPC & RMI. CS403/534 Distributed Systems Erkay Savas Sabanci University

Communication Basics, RPC & RMI. CS403/534 Distributed Systems Erkay Savas Sabanci University Communication Basics, RPC & RMI CS403/534 Distributed Systems Erkay Savas Sabanci University 1 Communication Models 1. Remote Procedure Call (RPC) Client/Server application 2. Remote Method Invocation

More information

DISTRIBUTED COMPUTING

DISTRIBUTED COMPUTING DISTRIBUTED COMPUTING SYSTEMS 1 REMOTE PROCEDURE CALL RPC-REMOTE PROCEDURE CALL RMI-REMOTE METHOD INVOCATION 2 3 RPC TECHNOLOGY Remote procedure call is a technology that allows computer programs to call

More information

Are Sockets a Good Programming Paradigm? EDA095 Remote Method Invocation. The Remote Procedure Call Model. The Remote Procedure Call Architecture

Are Sockets a Good Programming Paradigm? EDA095 Remote Method Invocation. The Remote Procedure Call Model. The Remote Procedure Call Architecture Are Sockets a Good Programming Paradigm? EDA095 Remote Method Invocation Pierre Nugues Lund University http://www.cs.lth.se/pierre_nugues/ May 2, 2013 To request a service from a server, sockets use explicit

More information

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark Network Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Outline Socket programming If we have the time: Remote method invocation (RMI) 2 Socket Programming Sockets

More information

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications Distributed Objects and Remote Invocation Programming Models for Distributed Applications Extending Conventional Techniques The remote procedure call model is an extension of the conventional procedure

More information

Remote Method Invocation in Java

Remote Method Invocation in Java Remote Method Invocation in Java Ajay Khatri Senior Assistant Professor,Department IT Acropolis Institute of Technology & Research ajay.acropolis@gmail.com What is RMI RMI is an API that provides a mechanism

More information

Are Sockets a Good Programming Paradigm? EDA095 Remote Method Invocation. The Remote Procedure Call Model. The Remote Procedure Call Architecture

Are Sockets a Good Programming Paradigm? EDA095 Remote Method Invocation. The Remote Procedure Call Model. The Remote Procedure Call Architecture Are Sockets a Good Programming Paradigm? EDA095 Remote Method Invocation Pierre Nugues Lund University http://www.cs.lth.se/home/pierre_nugues/ April 21, 2010 To request a service from a server, sockets

More information

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

Chapter 15: Distributed Communication. Sockets Remote Procedure Calls (RPCs) Remote Method Invocation (RMI) CORBA Object Registration Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote Method Invocation (RMI) CORBA Object Registration Sockets Defined as an endpoint for communcation Concatenation of IP

More information

Lab 2 : Java RMI. request sayhello() Hello interface remote object. local object. response "Hello world"

Lab 2 : Java RMI. request sayhello() Hello interface remote object. local object. response Hello world Lab 2 : Java RMI 1. Goals In this lab you will work with a high-level mechanism for distributed communication. You will discover that Java RMI provides a mechanism hiding distribution in OO programming.

More information

Java Remote Method Invocation Specification

Java Remote Method Invocation Specification Java Remote Method Invocation Specification Java Remote Method Invocation (RMI) is a distributed object model for the Java language that retains the semantics of the Java object model, making distributed

More information

CC755: Distributed and Parallel Systems

CC755: Distributed and Parallel Systems CC755: Distributed and Parallel Systems Dr. Manal Helal, Spring 2016 moodle.manalhelal.com Lecture 7: Remote Method Invocation (RMI) 1 RMI Y Daniel Liang, Introduction to JAVA Programming, 9th Edition,

More information

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

Distributed Systems. The main method of distributed object communication is with remote method invocation Distributed Systems Unit III Syllabus:Distributed Objects and Remote Invocation: Introduction, Communication between Distributed Objects- Object Model, Distributed Object Modal, Design Issues for RMI,

More information

Firewall Issues. The possible scenarios: the RMI client, the server, or both can be operating from behind a firewall

Firewall Issues. The possible scenarios: the RMI client, the server, or both can be operating from behind a firewall Firewall Issues Firewalls are inevitably encountered by any networked enterprise application that has to operate beyond the confines of an Intranet Typically, firewalls block all network traffic, with

More information

EDA095 Remote Method Invocation

EDA095 Remote Method Invocation EDA095 Remote Method Invocation Pierre Nugues Lund University http://www.cs.lth.se/pierre_nugues/ April 25, 2012 Covers: Elliotte Rusty Harold, Java Network Programming, 3 rd ed., Chapter 18, pages 610

More information

EDA095 Remote Method Invocation

EDA095 Remote Method Invocation EDA095 Remote Method Invocation Pierre Nugues Lund University http://www.cs.lth.se/pierre_nugues/ March 31, 2011 Covers: Elliotte Rusty Harold, Java Network Programming, 3 rd ed., Chapter 18, pages 610

More information

Object-Oriented Distributed Technology

Object-Oriented Distributed Technology Objects Objects in Distributed Systems Requirements of Multi-User Applications Reading: Coulouris: Distributed Systems, Chapter 5 Object-Oriented Languages Object Identity object identifiers (OIDs) OIDs

More information

Distributed Systems. Communication (2) Lecture Universität Karlsruhe, System Architecture Group

Distributed Systems. Communication (2) Lecture Universität Karlsruhe, System Architecture Group Distributed Systems Communication (2) Lecture 4 2003 Universität Karlsruhe, System Architecture Group 1 Overview Schedule of Today Remote Object (Method) Invocation Distributed Objects Binding Client to

More information

Serialisa(on, Callbacks, Remote Object Ac(va(on. CS3524 Distributed Systems Lecture 03

Serialisa(on, Callbacks, Remote Object Ac(va(on. CS3524 Distributed Systems Lecture 03 Serialisa(on, Callbacks, Remote Object Ac(va(on CS3524 Distributed Systems Lecture 03 Serializa(on Client Object Serialize De-Serialize Byte Stream Byte Stream Server Object De-Serialize Serialize How

More information

Distributed Information Systems

Distributed Information Systems Distributed Objects and Remote Invocation Programming Models For Distributed Applications Objectives RPC and RMI. Remote invocation semantics. Implementation of RMI. References DSCD: Chapter 5 Conventional

More information

Distributed Systems. Communication (2) Schedule of Today. Distributed Objects. Distributed Objects and RMI. Corba IDL Example

Distributed Systems. Communication (2) Schedule of Today. Distributed Objects. Distributed Objects and RMI. Corba IDL Example 1 Overview Distributed Systems Communication (2) Lecture 4 Schedule of Today Remote Object (Method) Invocation Binding Client to an Object Static versus Dynamic Binding Basics MPI, Sockets, Distributed

More information

Remote Procedure Calls

Remote Procedure Calls Remote Procedure Calls 1 Contents Remote procedure call Fundamentals RPC in C (under Unix/Linux) Remote Method Invocation Fundamentals Java RMI Distributed Systems: Core 2 REMOTE PROCEDURE CALLS (RPC)

More information

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

Lecture 5: RMI etc. Servant. Java Remote Method Invocation Invocation Semantics Distributed Events CDK: Chapter 5 TVS: Section 8.3 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

More information

What is Serialization?

What is Serialization? Serialization 1 Topics What is Serialization? What is preserved when an object is serialized? Transient keyword Process of serialization Process of deserialization Version control Changing the default

More information

Chapter 4 Remote Procedure Calls and Distributed Transactions

Chapter 4 Remote Procedure Calls and Distributed Transactions Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

Communication and Distributed Processing

Communication and Distributed Processing Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

Programming with RMI Reminder

Programming with RMI Reminder Programming with RMI Reminder (Sources: Gordon S Blair, Paul Grace) Aims After completing the following you should get a reminder of: 1. the fundamental concepts of Java Remote Method Invocation; 2. the

More information

4:40pm - 6:10pm (90 min)

4:40pm - 6:10pm (90 min) CMPT-401 Operating Systems II (Fall 2005) Midterm School of Computing Science Simon Fraser University October 18, 2005 4:40pm - 6:10pm (90 min) Last name: First name: Student number: Signature: Note: 1.

More information

Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma. Distributed and Agent Systems

Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma. Distributed and Agent Systems Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma Distributed and Agent Systems Prof. Agostino Poggi What is CORBA? CORBA (Common Object Request

More information

Distributed Objects. Remote Method Invokation

Distributed Objects. Remote Method Invokation Distributed Objects Remote Method Invokation Distributed Systems Object Oriented Paradigm invoke method Object 1 Object 2 respond Distributed Object Oriented Paradigm Client Host/Process invoke method

More information

Reflection/RMI 4/28/2009

Reflection/RMI 4/28/2009 Reflection/RMI 4/28/2009 1 Opening Discussion Solutions to the interclass problem. Do you have any questions about the assignment? Minute Essays Why are heap operations always O(log n)? Java programs connecting

More information

CSE 331. Memento Pattern and Serialization

CSE 331. Memento Pattern and Serialization CSE 331 Memento Pattern and Serialization slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/ 1 Pattern: Memento a

More information