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

Similar documents
JAVA RMI. Remote Method Invocation

RMI Case Study. A Typical RMI Application

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

CSci Introduction to Distributed Systems. Communication: RPC In Practice

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

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

Remote Procedure Call

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

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

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

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

Distributed Systems. 5. Remote Method Invocation

presentation DAD Distributed Applications Development Cristian Toma

5 Distributed Objects: The Java Approach

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

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

Remote Method Invocation

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

Programming with RMI Reminder

IJESRT. http: //

IBD Intergiciels et Bases de Données

5.4. Events and notifications

A Typical RMI Application

A Typical RMI Application. Case Study

RPC and RMI. 2501ICT Nathan

Remote Method Invocation in Java

Remote Objects and RMI

Reflection/RMI 4/28/2009

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

Lecture VI: Distributed Objects. Remote Method Invocation

Distributed Computing

Distributed Information Systems

Written by: Dave Matuszek

Distributed Objects SPL/ SPL 201 / 0 1

CS 5523 Operating Systems: Remote Objects and RMI

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

RMI. Remote Method Invocation. 16-Dec-16

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

Component-Based Software Engineering

Distributed Programming in Java. Distribution (2)

JAVA RMI Java, summer semester

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

RMI. (Remote Method Invocation)

Verteilte Systeme (Distributed Systems)

Distributed Systems. 6. Remote Method Invocation. Werner Nutt

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

Lecture 5: Object Interaction: RMI and RPC

SUMMARY INTRODUCTION REMOTE METHOD INVOCATION

Generic architecture

RMI Example RMI. CmpE 473 Internet Programming RMI

CC755: Distributed and Parallel Systems

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Distributed Systems COMP 212. Lecture 10 Othon Michail

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

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

Remote Method Invocation

Last Class: Network Overview. Today: Distributed Systems

Distributed Applications Programming. Lab 4

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

Outline. Chapter 4 Remote Procedure Calls and Distributed Transactions. Remote Procedure Call. Distributed Transaction Processing.

Remote Method Invocation R.M.I.

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

Remote Method Invocation

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

Lecture 06: Distributed Object

THE RMI PROXY USER GUIDE

CSS 533 Program 3: Mobile-Agent Execution Platform Professor: Munehiro Fukuda Due date: see the syllabus

Ibis RMI User s Guide

Web. Remote Method Invocation. core. programming. Training Courses: Java, JSP, Servlets, Struts, & JSF:

COMP 6231 Distributed Systems Design. Tutorial 2 by Alexandre Hudon January 21 st, 2013

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

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

Remote Invocation Vladimir Vlassov and Johan Montelius

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

Chapter 4 Remote Procedure Calls and Distributed Transactions

Communication and Distributed Processing

Lecture 17 Java Remote Method Invoca/on

Communication and Distributed Processing

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

Distributed object component middleware I - Java RMI

Remote Method Invocation. Benoît Garbinato

Remote Method Invocation Benoît Garbinato

Distributed object component middleware I - Java RMI

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

Dynamic code downloading using Java TM (Using the java.rmi.server.codebase Property)

Last Class: RPCs. Today:

Remote Method Invocation Java RMI & Web-Services

Distributed Software Systems

Lecture 15: Frameworks for Application-layer Communications

Lecture 15: Frameworks for Application-layer Communications

Chapter 5 Distributed Objects and Remote Invocation

Bharati Vidyapeeth s Institute of Computer Applications and Management A-4, Paschim Vihar, New Delhi-63.

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

RPC is a call to a procedure/function located on another machine

EAST WEST UNIVERSITY

BEA WebLogic. Server. Programming WebLogic RMI

Course Snapshot. The Next Few Classes

CHAPTER - 4 REMOTE COMMUNICATION

Distributed Objects. Remote Method Invokation

Distributed Applications Programming. Lab 7

Transcription:

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 Including material by Amy Apon at U. Arkansas Grid Computing 1 Grid Computing 2 Java Remote Method Invocation (RMI) The Java RMI is an object-oriented mechanism from Sun Microsystems for building distributed client/server applications Uses a client-side stub and a server-side skeleton (which is not needed in Java 1.2 or later) that are automatically generated from a class that extends java.rmi.unicastremoteobject and implements a RMI Remote interface RMI allows us to distribute our objects on various machines, and invoke methods on the objects located on remote sites. RMI Application Three entities A client that invokes a method on a remote object. A server that runs the remote object, which is an ordinary object in the address space of the server process. The object registry (rmiregistry), which is a name server that relates objects with names. Remote objects need to be registered with the registry. Once an object has been registered, the registry can be used to obtain access to a remote object using the name of that object. Grid Computing 3 Grid Computing 4 Kent State University 1

RMI Interface in Java A Class that Implements a RMI Interface RMI Compiler (rmic) Object Client Server Client Stub JRMP Server Skeleton Java RMI Nameserver (rmiregistry) TCP/IP codes implemented by programmer codes supplied by RMI package codes generated by RMI compiler Steps to implement and run using RMI Write a RMI interface. Write a RMI object to implement the interface. Use RMI compiler (rmic) to compile the RMI object to generate a client-side stub and a server-side skeleton. Write a RMI server to register the RMI object. Write a RMI client. Use Java compiler (javac) to compile all the Java source codes. Start the RMI name server (rmiregistry). Start the RMI server. Start the RMI client. Grid Computing 5 Grid Computing 6 Parameter Passing The situation when passing an object by reference or by value. 2-18 RMI advantages Uses an object-oriented approach, compared to the procedural one that RPC uses. Client can pass an object as a parameter to a remote object. Unlike RPC which needs an IDL interface, a Java RMI interface is written in Java. RMI has good support for marshalling, which is a process of passing parameters from client to a remote object, i.e., a Serializable Java object can be passed as a parameter. Grid Computing 7 Grid Computing 8 Kent State University 2

More Details Once the object (or service) is registered, a client can look up that service. A client (application) receives a reference that allows the client to use the service (call the method). Syntax of calling is identical to a call to a method of another object in the same program. Case Study : Calculator Let s create a distributed system using RMI model for networking (remote access) Server will implement calculator functions of square and power for arbitrary length integers (BigInt) Grid Computing 9 Grid Computing 10 Defining Remote Interface the interface extends Remote interface any class implementing Remote can be accessed remotely security permitting public interface TemperatureServer extends Remote { specify methods that can be called remotely each method throws RemoteException } Any time you depend on outside entities there is a potential for problems in communication, networking, server crash etc. Any exception due to these should be handled by the services. This feature imparts robustness to the application. Java mandates this feature for any RMI service. Implementing the Remote Interface import java.math.biginteger; PowerService Interface Interface for a RMI service that calculates powers public interface PowerService extends java.rmi.remote { Calculate the square of a number public BigInteger square ( int number ) throws RemoteException; } Calculate the power of a number public BigInteger power ( int num1, int num2) throws RemoteException; Grid Computing 11 Grid Computing 12 Kent State University 3

PowerServiceServer.java This class s constructor calls a private method which in turn: Implements the square and power methods The main method Assigns a security manager, in the event that dynamic classes are loaded instantiates an object for the service, and registers it with rmiregistry using bind or rebind Name Binding rebind method binds a server s object name to the object s name as it is in the registry. Clients use the name in the registry. There is also a bind() method. But rebind is better since it binds the most recently registered object. Grid Computing 13 Grid Computing 14 Server Object Name Syntax for the server object name is: host:port/remoteobjectname Default port number for rmiregistry is 1099 For local host the object name: localhost/tempserver For a remote host 127.0.0.1/TempServer PowerService Client import java.rmi.naming; import java.io.*; Assigns a security manager Calls registry for PowerService PowerService service = (PowerService) Naming.lookup ("rmi:" + args[0] + "/PowerService"); Displays prompts, takes input and invokes the appropriate method in service Grid Computing 15 Grid Computing 16 Kent State University 4

Client Details Preparing the Application The name of the server object along with the IP of the remote location is used in Naming class s lookup method to get an object reference. This object reference is then used for remote method calls. Observe that there is no difference between the local and remote call. 1. Compile all the classes using javac *.java 2. Generate the stub and the skeleton: rmic d. PowerServiceServer 3. Copy the classes to the public_html directory cp *.classes ~/username/public_html 4. Then start the registry (this will be running as a daemon) rmiregistry & Grid Computing 17 Grid Computing 18 Preparing the Application 5. Run the server which will register with the RMI registry. java - Djava.rmi.server.codebase=http:www.cs.kent.edu/~farrell/sys20 02/RMI/try3/ -Djava.security.policy=java.policy - Djava.rmi.server.hostname=arakis.cs.kent.edu PowerServiceServer 6. Run the client. setenv CLASSPATH /users/cs/faculty/farrell/public_html/sys2002/rmi/try3 java - Djava.rmi.server.codebase=http:www.cs.kent.edu/~farrell/sys20 02/RMI/try3/ -Djava.security.policy=java.policy PowerServiceClient arakis.cs.kent.edu Summary We discussed the various models of distributed systems. Java RMI was used to illustrate the distributed system concepts. A more general description of the process is at http:java.sun.com/docs/books/tutorial/rmi/index.html Grid Computing 19 Grid Computing 20 Kent State University 5