Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

Building Distributed Applications using JAVA - RMI
COS 461 Fall 1997 Network Objects u first good implementation: DEC SRC Network Objects for Modula-3 u recent implementation: Java RMI (Remote Method Invocation)
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
RPC Robert Grimm New York University Remote Procedure Calls.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Distributed Object & Remote Invocation Vidya Satyanarayanan.
Java Remote Method Invocation (RMI) In Java we implement object systems: O1O2 O3 thread 1thread 2 execution scheme JVM 1JVM 2 distribution scheme.
Remote Method Invocation
Remote Object Invocation
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
Introduction to Remote Method Invocation (RMI)
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Communication in Distributed Systems –Part 2
Beyond DHTML So far we have seen and used: CGI programs (using Perl ) and SSI on server side Java Script, VB Script, CSS and DOM on client side. For some.
Java RMI Essentials Based on Mastering RMI Rickard Oberg.
RMI Components java.rmi: client-side RMI classes, interfaces, and exceptions java.rmi.server: server-side RMI classes, interfaces, and exceptions java.rmi.registry:
+ A Short Java RMI Tutorial Usman Saleem
Information Management NTU Interprocess Communication and Middleware.
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.
New features for CORBA 3.0 by Steve Vinoski Presented by Ajay Tandon.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
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.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
IS473 Distributed Systems CHAPTER 5 Distributed Objects & Remote Invocation.
CORBA Common Object Request Broker Architecture. Basic Architecture A distributed objects architecture. Logically, an object client makes method calls.
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
Eric Tryon Brian Clark Christopher McKeowen. System Architecture The architecture can be broken down to three different basic layers Stub/skeleton layer.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Proxy Pattern. What’s a Proxy? A remote proxy acts as a local representative of a remote object Remote Object: instantiated in a different JVM heap (a.
Remote Method Invocation A Client Server Approach.
Distributed objects and remote invocation Pages
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.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
RMI1 Remote Method Invocation Adapted from “Core Java 2” by Cay Horstmann.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Distributed Objects. Contents I. The Roles of Client and Server II. Remote Method Calls III. The RMI Programming Model IV. Parameters and Return Values.
Java Distributed Object System
Java Remote Method Invocation (RMI)
Java Remote Method Invocation (RMI)
Remote Method Invocation
What is RMI? Remote Method Invocation
Knowledge Byte In this section, you will learn about:
Network and Distributed Programming in Java
Programming Models for Distributed Application
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
DISTRIBUTED COMPUTING
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
CSE 451: Operating Systems Winter 2007 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Creating a Distributed System with RMI
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Overview of RMI Architecture
Distribution Infrastructures
Java Remote Method Invocation
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Overview of RMI Architecture
Presentation transcript:

Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several auction clients When one client makes a higher bid, all the other clients need to be informed RMI is Synchronous Client Call Back provides a way to make it Asynchronous

Client Call Back Steps RMI Client acts as a RMI Server, RMI Server acts as RMI Client Server: provide a method in remote interface for client to register for events implement the method Client: provide a remote interface for server to invoke implement its remote interface call UnicastRemoteObject.exportObject(this) to export the client object call server's registration method create stubs and skeletons on the client side of the client implementation class

Distribution of Classes For the server, the following classes must be available to its class loader: Remote service interface definitions Remote service implementations Skeletons for the implementation classes (JDK 1.1 based servers only) Stubs for the implementation classes All other server classes For the client, the following classes must be available to its class loader: Remote service interface definitions Stubs for the remote service implementation classes Server classes for objects used by the client (such as return values) All other client classes

Automatic Distribution of Classes The RMI design extends the concept of class loading to include the loading of classes from FTP servers and HTTP servers dynamically Classes can be deployed in one, or only a few places, and all nodes in a RMI system will be able to get the proper class files from the servers Downloading stub for RMI Client Downloading parameter and return value classes for RMI Client and RMI Server Use java.rmi.server.codebase to specify a URL which points to the location that supplies classes Use java.security.policy to set the security policy file

Distributed Garbage Collection The RMI system provides a reference counting distributed garbage collection algorithm Server keep track of which clients have requested access to which remote objects A live client reference has a lease with a specified time If a client does not refresh the connection to the remote object before the lease term expires, the reference is considered to be dead and the remote object may be garbage collected. The lease time is controlled by the system property java.rmi.dgc.leaseValue (defaults to 10 minutes)

Distributed Garbage Collection (Cont.) The interface to the distributed garbage collector is hidden in the stubs and skeletons layer A remote object can implement the interface java.rmi.server.Unreferenced and get a notification via the unreferenced method when there are no longer any clients holding a live reference Because of these garbage collection semantics, a client must be prepared to deal with remote objects that have disappeared

Firewall Issues Firewalls are sometimes encountered by networked enterprise application Typically firewall blocks all network traffic except those intended for certain "well-known" ports RMI communication between client and server is typically blocked by most firewall implementations To get across firewalls, RMI makes use of HTTP tunneling by encapsulating the RMI calls and reply within HTTP protocol

Firewall Scenarios RMI transport layer automatically encapsulate the RMI call within an HTTP POST request HTTP-encapsulated data is decoded and dispatched by the RMI transport layer in the server Reply is then sent back to client as HTTP- encapsulated data RMI transport layer places RMI call inside the HTTP packets and send those packets to port 80 of the server On the Server unbundle the HTTP packet and forwards the call to the server process on the designated port Repliy from the server are sent back as HTTP REPLY packets to the originating client port where RMI again unbundles the information and sends it to the appropriate RMI stub.

Thread in RMI Remote method invocation on the same remote object may execute concurrently remote object implementation needs to make sure its implementation is thread-safe A method invocation dispatched by the RMI runtime to a remote object implementation may or may not execute in a separate thread

Proxy Pattern in RMI RealSubject in one context is represented by another (the proxy) in a separate context. The proxy knows how to forward method calls between the participating objects The Stub class plays the role of the proxy, and the remote service implementation class plays the role of the RealSubject

Applying Factory Pattern in RMI Provide a way to control and manage the access to ProductImpl Objects Reduce the objects that needed to be registered with RMI Registry Database Connection Pool

Applying Adapter Pattern in RMI Adapt a local class to a remote class Separate the local behavior and remote behavior Reuse the local class, remote interface doesn't match the class interface

Reference Sun RMI Page Sun online training MI.html MI.html Java World jGuru

Demo Client Call Back Automatic Distribution of Classes Distributed Garbage Collection