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

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.
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.
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.
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)
Chapter 4 Distributed objects and Remote Method Invocation
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
Architecture of Software Systems RMI and Distributed Components Martin Rehák.
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
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.
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.
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.
OOMI Callbacks. Slide 2 of 11 © Ingeniørhøjskolen i Århus Outline Motivation –Using TTS as example CORBA Callbacks Issues & solutions Alternative solutions.
Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
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.
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.
1 RPCs and Naming G53ACC Chris Greenhalgh. 2 Contents l Naming principles l Advantages l Patterns of use l Implementation issues l Examples l RMI registry.
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
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets
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
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 17 Goals of this lesson After this 1x35 lessons you will be –Introduced to the RMI registry (rmiregistry) –Introduced to RMI Callbacks Next time Java RMI Activation and RMI IIOP

Ingeniørhøjskolen i Århus Slide 3 af 17 Architecture ServerClient Stub Registry Interfaces Skeleton Activation Interfaces RMI Runtime (rmid,rmiregistry) coded manually rmic generated bind lookup RMI registry is light-weight version naming service

Ingeniørhøjskolen i Århus Slide 4 af 17 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 5 af 17 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 6 af 17 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 7 af 17 Limitations of RMI Registry 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 –DNS usage will partly solve this 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 8 af 17 Alternative Registry Use JNDI: Java Naming and Directory Interface –A standard API for accessing naming and directory services (like JDBC to databases) –Standard i Java: LDAP, RMI Registry, CORBA Naming service /tutorial/getStarted/overview/ind ex.html intro to JNDIhttp://java.sun.com/products/jndi /tutorial/getStarted/overview/ind ex.html /tutorial/objects/storing/remote.h tml JNDI and RMIhttp://java.sun.com/products/jndi /tutorial/objects/storing/remote.h tml

Ingeniørhøjskolen i Århus Slide 9 af 17 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 inconveniences. 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 10 af 17 Callbacks 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 -BUT: turn the client object into a remote object -Web services -No support.

Ingeniørhøjskolen i Århus Slide 11 af 17 Data Collection & Presentation Server TRS RMI/CORBA Object New Reading DB PSP View Readings Classic Client / Sever model is sufficient for Data Collection & Presentation

Ingeniørhøjskolen i Århus Slide 12 af 17 Alarm level surveillance Server TRS New Reading DB PSP View Readings Problem: The client / server pattern breaks down when we want to notify FROM the server to the client. Solution: Client polling OR peer-to-peer model -> e.g. using Callbacks Present Alarm RMI/CORBA Object

Ingeniørhøjskolen i Århus Slide 13 af 17 Issues Distributed Deadlock –If client and server single-threaded –Client calls server, server calls client back instantly –Deadlock – both are blocked, waiting for a response –Solution: Do not make single-threaded applications Problem: not all OS’s support multithreading Inconvenience : multithreading introduces new complexities Callback Persistence –Server should store registered callbacks on persistent storage in case of server failure Callback Failure –As callback objects are transient, server should employ a “timeout” strategy for callback communication Coupling –Callback objects comes at a price of higher coupling