Lecture 7: Java RMI. CS178: Programming Parallel and Distributed Systems. February 14, 2001 Steven P. Reiss



Similar documents
Remote Method Invocation in JAVA

Remote Method Invocation

When the transport layer tries to establish a connection with the server, it is blocked by the firewall. When this happens, the RMI transport layer

Remote Method Invocation (RMI)

! "# $%&'( ) * ).) "%&' 1* ( %&' ! "%&'2 (! ""$ 1! ""3($

H2O A Lightweight Approach to Grid Computing

Middleware Lou Somers

Programmation RMI Sécurisée

Network Communication

Report of the case study in Sistemi Distribuiti A simple Java RMI application

Introduction CORBA Distributed COM. Sections 9.1 & 9.2. Corba & DCOM. John P. Daigle. Department of Computer Science Georgia State University

Introduction to Web Services

A Distributed Object Model for the Java System

Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme. Middleware. Chapter 8: Middleware

Infrastructure that supports (distributed) componentbased application development

Socket = an interface connection between two (dissimilar) pipes. OS provides this API to connect applications to networks. home.comcast.

A Java-based system support for distributed applications on the Internet

Invocación remota (based on M. L. Liu Distributed Computing -- Concepts and Application

Motivation Definitions EAI Architectures Elements Integration Technologies. Part I. EAI: Foundations, Concepts, and Architectures

Elements of Advanced Java Programming

Overview of CORBA 11.1 I NTRODUCTION TO CORBA Object services 11.5 New features in CORBA Summary

Chapter 6. CORBA-based Architecture. 6.1 Introduction to CORBA 6.2 CORBA-IDL 6.3 Designing CORBA Systems 6.4 Implementing CORBA Applications

Java Remote Method Invocation Specification

SOFT 437. Software Performance Analysis. Ch 5:Web Applications and Other Distributed Systems

COMMMUNICATING COOPERATING PROCESSES

Web Services. Copyright 2011 Srdjan Komazec

Interface Definition Language

It is the thinnest layer in the OSI model. At the time the model was formulated, it was not clear that a session layer was needed.

The Java Series Introduction to Java RMI and CORBA. The Java Series. Java RMI and CORBA Raul RAMOS / CERN-IT User Support Slide 1

XII. Distributed Systems and Middleware. Laurea Triennale in Informatica Corso di Ingegneria del Software I A.A. 2006/2007 Andrea Polini

Lesson 4 Web Service Interface Definition (Part I)

Applets, RMI, JDBC Exam Review

Virtual machine interface. Operating system. Physical machine interface

Division of Informatics, University of Edinburgh

How To Write A Network Operating System For A Network (Networking) System (Netware)

Java Network. Slides prepared by : Farzana Rahman

Communication. Layered Protocols. Topics to be covered. PART 1 Layered Protocols Remote Procedure Call (RPC) Remote Method Invocation (RMI)

SCALABILITY AND AVAILABILITY

Grid Computing. Web Services. Explanation (2) Explanation. Grid Computing Fall 2006 Paul A. Farrell 9/12/2006

Module 17. Client-Server Software Development. Version 2 CSE IIT, Kharagpur

Load balancing using Remote Method Invocation (JAVA RMI)

How To Write A Mapreduce Program In Java.Io (Orchestra)

Chapter 2: Remote Procedure Call (RPC)

Service Oriented Architecture

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

Agent Languages. Overview. Requirements. Java. Tcl/Tk. Telescript. Evaluation. Artificial Intelligence Intelligent Agents

Tuple spaces and Object spaces. Distributed Object Systems 12. Tuple spaces and Object spaces. Communication. Tuple space. Mechanisms 2.

Service-Oriented Architecture and Software Engineering

Outline SOA. Properties of SOA. Service 2/19/2016. Definitions. Comparison of component technologies. Definitions Component technologies

PERFORMANCE COMPARISON OF COMMON OBJECT REQUEST BROKER ARCHITECTURE(CORBA) VS JAVA MESSAGING SERVICE(JMS) BY TEAM SCALABLE

RMI Client Application Programming Interface

The Microsoft Way: COM, OLE/ActiveX, COM+ and.net CLR. Chapter 15

25 May Code 3C3 Peeling the Layers of the 'Performance Onion John Murphy, Andrew Lee and Liam Murphy

Architecture of the CORBA Component Model CORBA 3.0

B) Using Processor-Cache Affinity Information in Shared Memory Multiprocessor Scheduling

Introduction to CORBA. 1. Introduction 2. Distributed Systems: Notions 3. Middleware 4. CORBA Architecture

Design Patterns in C++

Transparent Redirection of Network Sockets 1

USING THE SOFTWARE ADAPTER TO CONNECT LEGACY SIMULATION MODEL TO THE RTI

Distributed Internet Applications - DIA. Principles of Object-Oriented Middleware

Getting Started with the Internet Communications Engine

Transport layer protocols. Message destination: Socket +Port. Asynchronous vs. Synchronous. Operations of Request-Reply. Sockets

CS550. Distributed Operating Systems (Advanced Operating Systems) Instructor: Xian-He Sun

Transparent Redirection of Network Sockets 1

Implementing Java Distributed Objects with JDBC

e-gov Architecture Service Interface Guidelines

COM 440 Distributed Systems Project List Summary

Internet and Intranet Protocols and Applications

Going Interactive: Combining Ad-Hoc and Regression Testing

Lecture 17: Mobile Computing Platforms: Android. Mythili Vutukuru CS 653 Spring 2014 March 24, Monday

Tier Architectures. Kathleen Durant CS 3200

CORBA, DCOP and DBUS. A performance comparison.

7 Why Use Perl for CGI?

CS506 Web Design and Development Solved Online Quiz No. 01

Real Time Programming: Concepts

Introduction into Web Services (WS)

Mutual Exclusion using Monitors

A Comparison of Service-oriented, Resource-oriented, and Object-oriented Architecture Styles

A Short Introduction to Android

Network/Socket Programming in Java. Rajkumar Buyya

EJB & J2EE. Component Technology with thanks to Jim Dowling. Components. Problems with Previous Paradigms. What EJB Accomplishes

NETWORKING FEATURES OF THE JAVA PROGRAMMING LANGUAGE

Mail User Agent Project

Distributed Objects and Components

Java and Distributed Object Models: An Analysis

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2007 Lecture 5 - DBMS Architecture

Lecture 17. Process Management. Process Management. Process Management. Inter-Process Communication. Inter-Process Communication

Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c

Chapter 2: Enterprise Applications from a Middleware Perspective

Transcription:

Lecture 7: Java RMI CS178: Programming Parallel and Distributed Systems February 14, 2001 Steven P. Reiss I. Overview A. Last time we started looking at multiple process programming 1. How to do interprocess communications B. We looked first at sockets as a basic mechanism 1. Sockets provide the tools to communication 2. Two-way communications links C. But sockets aren t a logical approach 1. Want to deal with messages rather than raw data 2. Message mechanisms can be built on sockets D. What type of messages to consider 1. Informative messages -- process A informing process B that something happened 2. Data messages -- process A providing data to process B 3. Command messages -- process A asking process B to do something; process B sending the result of that request back to process A E. Central Message Server Architecture 1. Tools describe the messages they want to receive a) Either the commands they accept b) Or the information they want to know about 2. Tools send messages to the server a) Messages rebroadcast to interested tools 3. Tools can reply to messages (especially commands) a) Replies sent back to original sender CS178 Programming Parallel and Distributed Systems 1 Lecture 7

II. Remote Procedure Calls A. If we are sending commands across sockets 1. Why not think of these as procedure calls a) They are issued in one process b) And executed in a second process 2. This is the notion of remote procedure calls B. RPC availability 1. RPC has been around for quite a while a) Execution model b) Execution model with multiple threads 2. RPC tools a) Automatic generation of STUBS and SKELETONS from C declarations b) Libraries to do all the data encoding and decoding c) Libraries to handle authentication, finding servers,... III.Remote objects A. Motivation 1. As we move from procedural to OO programming 2. These should be method calls on remote objects 3. This is the basic idea in modern distributed message passing systems B. What are the issues that arise here 1. Identifying the object to be called 2. Passing arguments to the routine/method a) All the previous problems b) But objects are generally pointers, how to deal c) Also, how to deal with passing remote objects 3. Synchronous vs. asynchronous calls 4. Handling failure C. Lets start with what remote objects would look like to a client and server program 1. Diagram of object in server CS178 Programming Parallel and Distributed Systems 2 Lecture 7

2. What exists in the client a) Client needs an object for the programming language to work b) If I call a method on this object what should happen c) This yields a STUB 3. What exists in the server a) First the object must exist (we have that already) b) Second, someone has to take the message describing the call and decode it, make the call, encode the result, and send a message back c) This is a all class dependent d) Managed by a SKELETON for that class D. Representing remote objects in a language 1. The object needs to be the same in the client and the server a) But you have a stub in the client and a real object in the server b) But the two have different functionality c) What language construct provides for this 2. Remote objects are typically represented as interfaces a) This lets code ignore whether object is local/remote b) Allows for arbitrary implementation of the remote object c) This is done for CORBA, COM, and RMI in slightly different ways (1) COBRA, COM -- invent their own interfaces outside the language (2) Java RMI -- uses Java interfaces inside the language IV. Java RMI A. Representing Remote Objects 1. A RMI remote object is described by an interface a) That inherits from java.rmi.remote 2. Lets look at an example CS178 Programming Parallel and Distributed Systems 3 Lecture 7

a) Suppose we want to implement a calculator that operates remotely b) We define a calculator interface extending Remote B. Handling Errors 1. If we deal with multiple processes connected by a network, we lose control of lots of things a) Either process could be terminated or die b) The network might go down c) The processes might not agree on things (e.g. data formats) d) The code being executed can throw an exception 2. We want to ensure that the program deals with these cases in a reasonable way a) And make sure the programmer is aware that things can go wrong b) Thus all remote methods must be declared to throw java.rmi.remoteexception c) Or one of its supertypes (Exception, IOException) 3. Thus we have to change our example interface C. Implementing the remote class 1. We next have to define the class that exists in the server a) This will implement the remote interface b) But it has to do more (1) Slightly odd semantics for garbage collection, equals, hashcode (2) Handle creating an object to export (3) Server has to be registered so people can find the object 2. Thus the server has to inherit from RemoteServer a) java.rmi.server.unicastremoteobject b) Other choices (1) Designed so you can implement replicated objects CS178 Programming Parallel and Distributed Systems 4 Lecture 7

(2) Designed so you can create objects that automatically start a server 3. But method implementations are straightforward a) Throw remote exception, but otherwise as would be expected b) Continue with our example V. RMI Overall Architecture A. In order to use RMI, the client must be able to find the objects in order to call them 1. This is done by a separate process, the RMI Registry 2. Servers register remote objects with the registry 3. Clients lookup and get handles to these objects B. Starting the registry 1. rmiregistry command starts a registry 2. This should be run as a background process 3. Started once on the machine is enough 4. Runs at port 1099 by default C. Then there are calls to register/lookup names 1. Names are URL-like qualified items a) //host/dir/dir/item b) Use your own scheme to ensure uniqueness 2. Getting the registery a) You can access a registry explicitly b) Or use the default registry (easier) via java.rmi.naming 3. Binding calls a) Naming.bind(String url,remote obj) throws Already- BoundException, MalformedURLException, Remote- Exception b) Naming.rebind(String url,remote obj) throws MalformedURLException, RemoteException 4. Lookup calls a) Remote Naming.lookup(String url) throws NotBoundException, MalformedURLException, RemoteException CS178 Programming Parallel and Distributed Systems 5 Lecture 7

b) String [] list(string url) throws... -- provides a list of names bound at the given registry D. Implementing the server itself 1. The server has to do a couple of things a) Install a security manager if you are going to be working with applets, etc. if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()) } b) Create the server object c) Register that object using Naming.(re)bind 2. Put this into our example as main() in server a) Note that adding a remote object creates background threads that will keep running even after main exits b) These threads wait for the objects E. Implementing a client 1. The client needs to do a couple of things as well a) Install a security manager for applets, etc. b) Lookup the object to work with c) Invoke it. 2. Find the remote object a) Naming.lookup(url) 3. Invoke the remote object as you would normally a) Handling RemoteException at all points 4. Add this to our example as a test class VI.Next Time A. What is happening behind the scenes 1. Skeletons and stubs 2. Generating skeletons and stubs B. How arguments are passed 1. Object serialization and class loading 2. Passing remote objects 3. Receiving remote objects CS178 Programming Parallel and Distributed Systems 6 Lecture 7

C. Server complexities 1. Finding the proper server 2. Handling multiple servers 3. Creating a new server where appropriate D. Other remote object models 1. CORBA 2. DCOM CS178 Programming Parallel and Distributed Systems 7 Lecture 7