Florida State UniversityCOP5570 - Advanced Unix Programming Remote Method Invocation /rmi/index.html.

Slides:



Advertisements
Similar presentations
Remote Method Invocation CS587x Lecture Department of Computer Science Iowa State University.
Advertisements

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.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Remote Method Invocation
Company LOGO Remote Method Invocation Georgi Cholakov, Emil Doychev, University of Plovdiv “Paisii.
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.
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
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.
CMPT Dr. Alexandra Fedorova Lecture VI: Distributed Objects. Remote Method Invocation.
Introduction to Remote Method Invocation (RMI)
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Java RMI RMI = Remote Method Invocation. Allows Java programs to invoke methods of remote objects. Only between Java programs. Several versions (JDK-1.1,
Internet Software Development Remote Method Invocation Paul Krause.
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets Rethinking out tic-tac-toe game.
1 Java Programming II Java Network II (Distributed Objects in Java)
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
+ 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.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Java RMI: Remote Method Invocation January 2000 Nancy McCracken Syracuse University.
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.
RMI-IIOP.  RMI-IIOP combines RMI-style ease of use with CORBA cross-language interoperability  Java™ Remote Method Invocation (RMI) provides a simple.
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.
Remote Method Invocation onlineTraining/rmi/RMI.html.
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.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Presentation: RMI introduction. Goals of this lesson After this 35 min. lesson you will be: Introduced to Java RMI Ready to present RMI’s position in.
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 17/10/2007.
RMI , Naming Service, Serialization and Internationalization Chapter 4
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Presentation 11: RMI introduction. Ingeniørhøjskolen i Århus Slide 2 af 20 Goals of this lesson After these 2x35 lessons you will be –Introduced to Java.
Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Creating Applications Using RMI Lesson 1B / Slide 1 of 19 Network and Distributed Programming in Java Pre-assessment Questions 1.Which of the following.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Remote Method Invocation RMI architecture stubs and skeletons for remote services RMI server and client in Java Creating an RMI Application step-by- step.
Java RMI. RMI Any object whose methods can be invoked from another Java VM is called a remote object.
1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation.
Java Distributed Object Model A remote object is one whose methods can be invoked from another JVM on a different host. It implements one or more remote.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
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.
Using RMI The Example of A Remote Calculator 1. Parts of A Working RMI System A working RMI system is composed of several parts. –Interface definitions.
RMI1 Remote Method Invocation Adapted from “Core Java 2” by Cay Horstmann.
Java Remote Method Invocation (RMI)
Remote Method Invocation
What is RMI? Remote Method Invocation
Remote Method Invocation
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets
Java RMI (more) CS-328 Internet Programming.
Using RMI -The Example of A Remote Calculator
CS 584 Lecture 18 Assignment Glenda assignment extended to the Java RMI Deadline No Java RMI Assignment Test Friday, Saturday, Monday.
Java Remote Method Invocation
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Florida State UniversityCOP Advanced Unix Programming Remote Method Invocation /rmi/index.html

Florida State UniversityCOP Advanced Unix Programming RMI Abstraction Local object Remote Object Client Server Method call Return Argument

Florida State UniversityCOP Advanced Unix Programming Behavior Vs. Implementation Interface Implementation Client program Server program RMI System

Florida State UniversityCOP Advanced Unix Programming How RMI Works Client ProgramServer Program Server Stub Server Skeleton Remote Reference Layer TCP/IP

Florida State UniversityCOP Advanced Unix Programming Local Vs. Remote Objects Object reference points to local object. Object arguments in methods are passed by reference. Garbage collection when no more local references. Object reference points to a proxy (stub) object. Object arguments in methods are passed by value. Garbage collection when no more local or remote references.

Florida State UniversityCOP Advanced Unix Programming Example : Remote Calculator

Florida State UniversityCOP Advanced Unix Programming The Interface 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; }

Florida State UniversityCOP Advanced Unix Programming Remote Object Implementation public class CalculatorImpl extends java.rmi.server.UnicastRemoteObject implements Calculator { // Must have an explicit constructor public CalculatorImpl() throws java.rmi.RemoteException { super(); } public long add(long a, long b) throws java.rmi.RemoteException { return a + b; } public long sub(long a, long b) throws java.rmi.RemoteException { return a - b; } // Similarly implement mul() and div() }

Florida State UniversityCOP Advanced Unix Programming Alternative Remote Object Implementation public class CalculatorImpl implements Calculator //Doesn’t extend UnicastRemoteObject { // constructor doesn’t call super() – instead calls exportObject() public CalculatorImpl() { UnicastRemoteObject.exportObject(this); } public long add(long a, long b) throws java.rmi.RemoteException { return a + b; } public long sub(long a, long b) throws java.rmi.RemoteException { return a - b; } // Similarly implement mul() and div() }

Florida State UniversityCOP Advanced Unix Programming Creating Stubs and Skeletons Compile the interface % javac Calculator.java Compile the implementation % javac CalculatorImpl.java Create Stubs and Skeletons % rmic CalculatorImpl This creates CalculatorImpl_Stub.class and CalculatorImpl_Skel.class

Florida State UniversityCOP Advanced Unix Programming Server Code import java.rmi.Naming; public class CalculatorServer { public static void main(String args[]) { try { Calculator c = new CalculatorImpl(); Naming.rebind( "rmi://linprog1/CalculatorService", c); } catch (Exception e) { System.out.println("Trouble: " + e); }

Florida State UniversityCOP Advanced Unix Programming Client Code import java.rmi.*; public class CalculatorClient { public static void main(String[] args) { try { Calculator c = (Calculator)Naming.lookup( "rmi://linprog1/CalculatorService"); System.out.println( c.sub(4, 3) ); System.out.println( c.add(4, 5) ); System.out.println( c.mul(3, 6) ); System.out.println( c.div(9, 3) ); } catch (Exception e) { System.out.println("Trouble: " + e); }

Florida State UniversityCOP Advanced Unix Programming Running it all Copy the following to server machine –CalculatorServer.class –CalculatorImpl_Skel.class –CalculatorImpl.class –Calculator.class Copy the following to client machine –CalculatorClient.class –CalculatorImpl_Stub.class –Calculator.class

Florida State UniversityCOP Advanced Unix Programming Running it all…. At server machine % rmiregistry & % java CalculatorServer At client machine % java CalculatorClient

Florida State UniversityCOP Advanced Unix Programming Parameter Passing & Return Values

Florida State UniversityCOP Advanced Unix Programming Single JVM Primitive data types –Pass by value Objects –Pass by reference –All objects in Java are on the heap.

Florida State UniversityCOP Advanced Unix Programming Between Remote JVMs Using RMI Primitive data types –By value Local Objects –By value again. –No common heap between remote JVMs! –But what’s the problem in passing objects by value?

Florida State UniversityCOP Advanced Unix Programming Serialization Flatten the object being passed and any objects it references. Need to “marshall” (copy) all members fields of objects being passed. Fields may be object references! So follow the object reference and perform a “deep-copy”.