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

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

#,!" $* ( #+,$ $$ $# -.,$ / 0' ".12 $ $$ 5/ #$" " " $ $ " # $ / 4 * # 6/ 8$8 ' # 6 $! 6$$ #$ * $ $$ ** 4 # 6 # * 0; & *! # #! #(' 7 / $#$ -.

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

Programming with RMI Reminder

JAVA RMI. Remote Method Invocation

Remote Method Invocation

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

Distributed Information Systems

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

Remote Method Invocation

Remote Procedure Call

CSC 634: Networks Programming

Remote Method Invocation

Last Class: Network Overview. Today: Distributed Systems

Written by: Dave Matuszek

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

RMI. (Remote Method Invocation)

Generic architecture

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

RMI. Remote Method Invocation. 16-Dec-16

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

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

DISTRIBUTED COMPUTING

Lecture VI: Distributed Objects. Remote Method Invocation

1 interface TemperatureSensor extends java.rmi.remote 2 { 3 public double gettemperature() throws java.rmi.remoteexception; 4 public void

presentation DAD Distributed Applications Development Cristian Toma

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

JAVA RMI Java, summer semester

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

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

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

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

Remote Method Invocation in Java

Component-Based Software Engineering

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

RMI Case Study. A Typical RMI Application

Verteilte Systeme (Distributed Systems)

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

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

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

Distributed Objects SPL/ SPL 201 / 0 1

5.4. Events and notifications

Distributed Systems COMP 212. Lecture 10 Othon Michail

Java Programming Language Advance Feature

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

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

IBD Intergiciels et Bases de Données

Xx Xx xx CORBA. 4 Dr. Ahmed ElShafee, ACU Spring 2011, Distributed Systems

Distributed Software Systems

Distributed Computing

CSci Introduction to Distributed Systems. Communication: RPC In Practice

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

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

RPC and RMI. 2501ICT Nathan

EAST WEST UNIVERSITY

Course Snapshot. The Next Few Classes

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:

RMI Example RMI. CmpE 473 Internet Programming RMI

Reflection/RMI 4/28/2009

Distributed Programming in Java. Distribution (2)

A Typical RMI Application

IJESRT. http: //

A Typical RMI Application. Case Study

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

Distributed object component middleware I - Java RMI

Architecture of So-ware Systems RMI and Distributed Components. Mar<n Rehák

Distributed Systems. 5. Remote Method Invocation

Distributed object component middleware I - Java RMI

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

Remote Method Invocation R.M.I.

CC755: Distributed and Parallel Systems

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

Distributed Objects. Chapter Distributing Objects Overview

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

Chapter 4 Remote Procedure Calls and Distributed Transactions

Communication and Distributed Processing

Lecture 15: Frameworks for Application-layer Communications

Developing RMI Based Server (ChatServer)

Lecture 15: Frameworks for Application-layer Communications

5 Distributed Objects: The Java Approach

Distributed Applications Programming. Lab 4

BSc ( Hons) Computer Science with Network Security. Examinations for / Semester 2

Communication and Distributed Processing

Department of Computer Science & Engineering. M.Tech(CSE)-I Year-II Semester WEB SERVICES AND SERVICE ORIENTED ARCHITECHTURE (B1513) Mr.K.

Modulo II Socket, RMI e Corba

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

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

RIKA: Component Architectures

SUMMARY INTRODUCTION REMOTE METHOD INVOCATION

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

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

Concurrent Programming (RIO) Lesson 9. Ch 8 [BenA 06] Messages Channels Rendezvous RPC and RMI. X=f(..); send X to B. OS kernel.

COMP 6231: Distributed System Design

CS 5523 Operating Systems: Remote Objects and RMI

Distributed Objects. Object-Oriented Application Development

Distributed Systems. 6. Remote Method Invocation. Werner Nutt

The Common Object Request Broker Architecture (CORBA)

Sockets and RMI. CS151 Chris Pollett Dec. 5, 2005.

Remote Objects and RMI

Transcription:

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 defined by RMI interfaces Designing and developing RMI Server Designing and developing a RMI Client Deploying and running the RMI system 2

Building Calculator RMI System 1 2 3 4 5 Design and implement Java RMI Calculator interfaces Develop Java code implementing classes defined by RMI Calculator interfaces Develop code for Java RMI Calculator server Develop code for Java RMI Calculator client program Install and run RMI Calculator system 3

Naming Remote Objects How could a client find an RMI remote server (service)? RMI System includes a simple service called the RMI Registry: rmiregistry On a server machine, a server program creates a remote service and register it in the RMI registry. On the client side, RMI Registry is accessed through the class Naming. The static method lookup(string url) is the method a client uses it to query a registry. The method returns a remote reference to the service object. The URL parameter of a lookup method takes the form: rmi://<host_name>[:<service_port>]/<service_name> 4

Overview of RMI RMI Client Machine RMI Server Machine Look up server RMI Registry RMI Client Method call RMI Server Stub Parameters TCP/IP Return value Skeleton 5

1 Calculator Interfaces Interface defines all of the remote features offered by the server Calculator.java public interface Calculator extends java.rmi.remote { public long add(long a, long b) throws java.rmi.remoteexception; public long sub(long a, long b) throws java.rmi.remoteexception; public long mul(long a, long b) throws java.rmi.remoteexception; public long div(long a, long b) throws java.rmi.remoteexception; 6

2 Calculator Implementation Class The implementation of the interface for the remote service. CalculatorImpl.java public class CalculatorImpl extends java.rmi.server.unicastremoteobject implements Calculator { //Implementations must have an explicit constructor //in order to declare the RemoteException exception public CalculatorImpl() throws java.rmi.remoteexception { super(); public long add(long a, long b)throws java.rmi.remoteexception { return a + b;... 7

Calculator RMI Server The class CalculatorServer.java is a server class that has only constructor. 8

4 Calculator RMI Client RMI Client: CalculatorClient.java import java.rmi.naming; import java.rmi.remoteexception; import java.net.malformedurlexception; import java.rmi.notboundexception; public class CalculatorClient { public static void main(string[] args) { try { Calculator c = (Calculator)Naming.lookup("rmi://localhost/CalculatorService"); System.out.println( c.sub(4, 3) ); catch (MalformedURLException murle) { System.out.println(murle); catch (RemoteException re) { System.out.println(re); catch (NotBoundException nbe) { System.out.println(nbe); 9

5 Running Calculator RMI System Run the Registry. You must be in the directory that contains the classes you have developed. From there, enter the following rmiregistry Start the RMI calculator server hosting the Calculator service java CalculatorServer Run the RMI calculator client program java CalculatorClient 10

RMI over IIOP Common Object Request Broker Architecture CORBA Remote Method Invocation (RMI) over Internet Inter-Orb Protocol (IIOP) access distributed objects on the Internet 11

Run RMI System RMI Registry 1 Bind Lookup 2 RMI Server 3 Method Invocation RMI Client

Conclusion After completion of this lesson you should know: How to design distributed applications using RMI. How to develop Java RMI programs. How to deploy applications using RMI tools. 13