Presentation: RMI Continued 2 Using The Registry & Callbacks.

Slides:



Advertisements
Similar presentations
Local vs. distributed Objects Differences between local and distributed objects in: –References (to objects) –Activation/Deactivation –Migration –Persistence.
Advertisements

What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Remote Method Invocation (RMI) Mixing RMI and sockets
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.
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.
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.
George Blank University Lecturer. RMI Introduction to RMI.
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.
Java RMI. What is RMI? RMI is an RPC system for an object based language. Objects provide a natural granularity for the binding of functions. –RMI allows.
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.
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.
Practical Issues of RPCCS-4513, D-Term Remote Procedure Call Practical Issues CS-4513 Distributed Computing Systems (Slides include materials from.
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.
CS603 Communication Mechanisms: DCE RPC (cont.) 23 January 2002.
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets Rethinking out tic-tac-toe game.
Slides for Chapter 5: Communication between distributed objects
RMI Components java.rmi: client-side RMI classes, interfaces, and exceptions java.rmi.server: server-side RMI classes, interfaces, and exceptions java.rmi.registry:
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.
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.
1 Classnote#12 RMI. 2 RMI applications are often comprised of two separate programs: – a server and a client. A typical server application –creates some.
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.
Presentation 18: RMI introduction. Goals of this lesson After this 35 min. lesson you will be: Introduced to Java RMI Ready to present RMI’s position.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
RMI RMI is the java API that facilitate distributed computing by allowing remote method calls. A remote method call represents a method invocation between.
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.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
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.
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.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
RMI Example. Compilation: /home2/fccheng/temp/RMI2> javac MyObject.java /home2/fccheng/temp/RMI2> javac RemoteServer.java /home2/fccheng/temp/RMI2> javac.
Slides for Chapter 5: Distributed objects and remote invocation From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition.
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 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
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.
Presentation 13: RMI continued – more advanced issues: Activation & RMI over IIOP.
January 26, Ann Wollrath Copyright 1999 Sun Microsystems, Inc., all rights reserved. Java ™ RMI Overview Ann Wollrath Senior Staff Engineer Sun Microsystems,
Java Remote Method Invocation (RMI)
What is RMI? Remote Method Invocation
Remote Method Invocation
Advanced Remote Method Invocations
Java RMI (more) CS-328 Internet Programming.
Network and Distributed Programming in Java
Slides for Chapter 5: Distributed objects and remote invocation
Remote method invocation (RMI)
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:

Presentation: RMI Continued 2 Using The Registry & Callbacks

Ingeniørhøjskolen i Århus Slide 2 af 12 Goals of this lesson After this 1x35 lessons you will be –Introduced to the RMI registry (rmiregistry) And how to use it –Introduced to RMI Callbacks Next time Java RMI Activation and RMI IIOP

Ingeniørhøjskolen i Århus Slide 3 af 12 Outline Group presentation –RMI compared with Web services (SOAP) Theory: (35 min.) –Repetition from last time The Architecture of Java RMI and the RMI registry –The concept of Callbacks in Java RMI Exercises –Many had trouble last time –Complete this –Make a callback version of HelloWorld

Ingeniørhøjskolen i Århus Slide 4 af 12 Java compiler - javac Server HelloClient.java HelloImpl.java Java compiler - javac Client Hello.java included in generates reads rmic Compiler RMI Client and Server Implementation HelloImpl_Stub.class HelloImpl_Skeleton.class

Ingeniørhøjskolen i Århus Slide 5 af 12 Architecture ServerClient Stub Registry Interfaces Skeleton Activation Interfaces RMI Runtime (rmid,rmiregistry) coded manually rmic generated bind lookup

Ingeniørhøjskolen i Århus Slide 6 af 12 Naming in RMI: The RMI Registry Simplified version of CORBA Naming No composite names Security Restriction: Name bindings cannot be created from remote hosts There has to be a registry on each host

Ingeniørhøjskolen i Århus Slide 7 af 12 Naming in RMI: The RMI Registry package java.rmi.registry; public interface Registry extends java.rmi.Remote { public static final int REGISTRY_PORT = 1099; public java.rmi.Remote lookup(String name) throws java.rmi.RemoteException, java.rmi.NotBoundException, java.rmi.AccessException; public void bind(String name, java.rmi.Remote obj) throws java.rmi.RemoteException, java.rmi.AlreadyBoundException, java.rmi.AccessException; public void rebind(String name, java.rmi.Remote obj) throws java.rmi.RemoteException, java.rmi.AccessException; public void unbind(String name) throws java.rmi.RemoteException, java.rmi.NotBoundException, java.rmi.AccessException; public String[] list() throws java.rmi.RemoteException, java.rmi.AccessException; }

Ingeniørhøjskolen i Århus Slide 8 af 12 package examples.hello; import java.rmi.Naming; import java.rmi.RemoteException; import java.rmi.RMISecurityManager; import java.rmi.server.UnicastRemoteObject; public class HelloImpl extends UnicastRemoteObject implements Hello { public HelloImpl() throws RemoteException { super(); } public String sayHello() { return "Hello World! ; } public static void main(String args[]) { // Create and install a security manager //if (System.getSecurityManager() == null) { // System.setSecurityManager(new RMISecurityManager()); //} try { HelloImpl obj = new HelloImpl(); // Bind this object instance to the name "HelloServer" Naming.rebind("rmi:// /HelloServer", obj); System.out.println("HelloServer bound in registry"); } catch (Exception e) { System.out.println("HelloImpl err: " + e.getMessage()); e.printStackTrace(); } Server object (HelloImpl.java) Instantiate a new object and register (bind it) in the ”rmiregistry” Following methods available: bind, rebind, unbind, lookup Instantiate a new object and register (bind it) in the ”rmiregistry” Following methods available: bind, rebind, unbind, lookup

Ingeniørhøjskolen i Århus Slide 9 af 12 package examples.hello; import java.rmi.Naming; import java.rmi.RemoteException; public class HelloClient { public static void main(String args[]) { try { obj = (Hello)Naming.lookup("rmi:// /HelloServer"); String message = obj.sayHello(); System.out.println(message); } catch (Exception e) { System.out.println("HelloApplet exception: " + e.getMessage()); e.printStackTrace(); } ”lookup” the HelloServer – and call Method sayHello() on Stub ”lookup” the HelloServer – and call Method sayHello() on Stub Client object (HelloClient.java)

Ingeniørhøjskolen i Århus Slide 10 af 12 Limitations of Naming Limitation of Naming in all approaches: Client always has to identify the server by name. obj = (Hello)Naming.lookup("rmi:// /HelloServer"); Inappropriate if client just wants to use a service at a certain quality but does not know from who: –Automatic cinema ticketing, –Video on demand, –Electronic commerce. Security restriction breaks name location transparency

Ingeniørhøjskolen i Århus Slide 11 af 12 Nice feature – bootstrapping the Registry As until now, you have been manually starting the RMI Registry, which is a constant source of errors and other inconviances. May be solved more elegantly: –LocateRegistry.createRegistry(PORT); And you are up and running, ready to bind remote objects

Ingeniørhøjskolen i Århus Slide 12 af 12 Callbacks Remember PRJ3 / OBJ? Sometimes Client/Server is not enough Publish/Subscribe pattern / Observer CORBA has support for this –An ORB is always both client and server Java RMI does not have support for this Solution: –Turn the client object into a remote object