Distributed Systems/Middleware JavaSpaces

Similar documents
CA341 - Comparative Programming Languages

Ubiquitous Computing Summer Supporting distributed applications. Distributed Application. Operating System. Computer Computer Computer.

Philadelphia Area Java Users' Group December 12, 2001

Middleware-Konzepte. Tuple Spaces. Dr. Gero Mühl

Trading Services for Distributed Enterprise Communications. Dr. Jean-Claude Franchitti. Presentation Agenda

Jini Technology Overview

The Jini architecture. Johan Petrini and Henning Sundvall

Page 1. Extreme Java G Session 8 - Sub-Topic 2 OMA Trading Services

A Tutorial on The Jini Technology

Linda, JavaSpaces & Jini

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Lecture 5: Object Interaction: RMI and RPC

Jini and Universal Plug and Play (UPnP) Notes

Implementing Jini Servers without Object Serialization Support

JavaSpaces technology for distributed communication and collaboration. Chih-Yao Hsieh

JavaSpaces Specification

Electronic Payment Systems (1) E-cash

Communication. Overview

UPnP Services and Jini Clients


Communication Paradigms

Wendy Lee CHAPTER 1 INTRODUCTION. Jini which is based on Java platform is a network technology from Sun

CALIFORNIA SOFTWARE LABS

5.4. Events and notifications

Distributed Middleware. Distributed Objects

Service Provision in Ad Hoc Networks

Distributed Programming in Java

Indirect Communication

BA (Hons) Degree in Computing Final Year Project Report (2001/2002)

Distributed Systems. The main method of distributed object communication is with remote method invocation

CALIFORNIA SOFTWARE LABS

Support Readiness Document Jini Technology Starter Kit 1.1

Advanced Topics in Operating Systems

Linda, FT-Linda, and Jini

Lecture 06: Distributed Object

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4

Jini Architecture Specification

Jini Supporting Ubiquitous and Pervasive Computing

Chapter 2 Architectures. Software Architectures

Indirect Communication

Desarrollo de Aplicaciones en Red RMI. Introduction. Considerations. Considerations. RMI architecture

Distributed Programming in Java. Distribution (2)

Verteilte Systeme (Distributed Systems)

Interprocess Communication

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

A Custom Lookup Service for UPnP Services and Jini Clients

COMMUNICATION IN DISTRIBUTED SYSTEMS

Jini Connection Technology Architecture Overview

Communication. Distributed Systems Santa Clara University 2016

one.world Towards a System Architecture for Pervasive Computing

CHAPTER - 4 REMOTE COMMUNICATION

Communication. Outline

MODELS OF DISTRIBUTED SYSTEMS

Page 1. CS 194: Distributed Systems Distributed Coordination-based Systems. Coordination Systems. Taxonomy of Coordination Models

Chapter 5: Distributed objects and remote invocation

Computer and Automation Research Institute Hungarian Academy of Sciences. Jini and the Grid. P. Kacsuk

Adaptive Cluster Computing using JavaSpaces

Questions and Answers. A. RMI allows us to invoke a method of java object that executes on another machine.

Today: Distributed Objects. Distributed Objects

PARALLEL PROGRAM EXECUTION SUPPORT IN THE JGRID SYSTEM

Today: More Case Studies DCOM

Q.1. (a) [4 marks] List and briefly explain four reasons why resource sharing is beneficial.

RPC and RMI. 2501ICT Nathan

Remote Method Invocation. Benoît Garbinato

Remote Method Invocation Benoît Garbinato

Time and Space. Indirect communication. Time and space uncoupling. indirect communication

Jini for Ubiquitous Devices

Screen Saver Science: Realizing Distributed Parallel Computing with Jini and JavaSpaces

(9A05803) WEB SERVICES (ELECTIVE - III)

Chapter 10 DISTRIBUTED OBJECT-BASED SYSTEMS

Learning Objective. Project Objective

Lecture 9. Part I. Overview of Message Passing. Communication Coupling. Decoupling Blackboard. Decoupling Broadcast. Linda and Erlang.

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2)

SFDV3006 Concurrent Programming

Chapter 5 Distributed Objects and Remote Invocation

Indirect Communication

Distributed Technologies - overview & GIPSY Communication Procedure

T NAF: Jini & EJB

MODELS OF DISTRIBUTED SYSTEMS

Embedded Device Cooperative System Using Java Bytecode Instrumentation

MTAT Enterprise System Integration. Lecture 2: Middleware & Web Services

Concurrent Object-Oriented Programming

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Two Phase Commit Protocol. Distributed Systems. Remote Procedure Calls (RPC) Network & Distributed Operating Systems. Network OS.

DS 2009: middleware. David Evans

Lookup. Michael Kircher & Prashant Jain Siemens AG, Corporate Technology Munich, Germany

DISTRIBUTED SYSTEMS [COMP9243] Distributed Object based: Lecture 7: Middleware. Slide 1. Slide 3. Message-oriented: MIDDLEWARE

Lecture 8. Linda and Erlang

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

Agent Space Architecture for Search Engines

Comparison of Bandwidth Usage: Service Location Protocol and Jini

Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma. Distributed and Agent Systems RMI

Collaboration of Tasks

Project 1: Remote Method Invocation CSE 291 Spring 2016

Concurrent ML. John Reppy January 21, University of Chicago

Interprocess Communication

Chapter 4 Communication

Distributed Systems Principles and Paradigms

Today: Distributed Middleware. Middleware

Transcription:

Distributed Systems/Middleware JavaSpaces Alessandro Sivieri Dipartimento di Elettronica e Informazione Politecnico, Italy sivieri@elet.polimi.it http://corsi.dei.polimi.it/distsys Slides based on previous works by Alessandro Margara

Linda and tuple spaces Data sharing model proposed in the 80s by Carriero and Gelernter, mostly used for parallel computation Recently revitalized in the context of distributed computing E.g., IBM TSpaces, Sun JavaSpaces, GigaSpaces Also used in WSNs, e.g. TeenyLime Communication is persistent, implicit, content-based, generative High degree of decoupling Workers Tuple Space < Japan, Kyoto > in(p) < USA, Los Angeles > < USA, St. Louis > rd(p) out(t) < Italy, Milan > Distributed Systems: MOM & Shared Data Spaces 2

Linda in a nutshell Data is contained in ordered sequences of typed fields (tuples) Tuples are stored in a persistent, global shared space (tuple space) Standard operations: out(t): writes the tuple t in the tuple space rd(p): returns a copy of a tuple matching the pattern (or template) p, if it exists Blocks waiting for matching tuples otherwise If many matching tuples exist, one is chosen nondeterministically in(p): like rd(p), but withdraws the matching tuple from the tuple space Some implementations provide also an eval(a), which inserts the tuple generated by the execution of a process a Distributed Systems: MOM & Shared Data Spaces 3

Linda in a nutshell Many variants: Asynchronous, non-blocking primitives (probes): rdp(p) and inp(p) Return immediately a null value if the matching tuple is not found Bulk primitives: e.g., rdg(p) Some of the non-standard primitives have non-trivial distributed implementations E.g., if atomicity is to be preserved, probes require a distributed transaction Distributed Systems: MOM & Shared Data Spaces 4

Architectural issues The tuple space model is not easily scaled on a wide-area network How to store/replicate tuples efficiently How to route queries efficiently The model is only proactive Processes explicitly request a tuple query reactive/asynchronous behavior must implemented with an extra process and a blocking operation As a consequence, commercial implementations: Provide only client access to a server holding the tuple space Instead of a fully distributed, decentralized implementation Introduce reactive primitives e.g., notify allows to register a listener, invoked when a matching tuple is written Distributed Systems: MOM & Shared Data Spaces 5

Jini Jini is a distributed services architecture developed at Sun focusing on network dynamicity It is composed by several specifications Discovery, registration, and binding of service Configuration Security Coordination Javaspaces, Mailboxes, Remote Event Notification Fault Tolerance Leasing, Transactions Specs reference implementation: Jini Starter Kit Now called Apache River Distributed Systems: MOM & Shared Data Spaces 6

Apache River Apache River provides Jini Specifications Helper Classes that implement them Services that implement them It is built on top of J2SE technology Not compatible with Java 7 Security Discovery Leasing Transactions Notifications Configuration Discovery Classes Join Manager Lease Renewal Manager Lookup Service Lease Renewal Service Transaction Manager JavaSpace RMI JERI Activation Distributed Systems: MOM & Shared Data Spaces 7

Browsing the SDK Three important services (for our examples): 1. HTTP server (codebase) 2. Lookup service ( Reggie ) 3. JavaSpaces service ( Outrigger ) Other services: Transaction service ( Mahalo ) RMI implementation ( Phoenix ) Event Mailbox service ( Mercury ) Leases ( Norm ) Distributed Systems: MOM & Shared Data Spaces 8

Discovery Service Oriented Architecture Applications are composed of services When an application needs to perform a task, it searches for a service providing the suitable functionality Services are usually not bound to each other at design/compile time but they discover each other at runtime The process of searching for a suitable service is performed through a special service called registry Distributed Systems: MOM & Shared Data Spaces 9

Typical Jini interaction One of Jini s main goal is to seamlessly discover who is providing a service: once this is achieved, the service is usually performed using RMI Discovery of services is aided by a Lookup Service (LUS) You can think of it as an RMI registry for resolving interfaces instead of names Exploits mobile code: service proxies are dynamically downloaded, and enable the client to use a service without pre-deployed code Lookup Service usually returns a proxy Service usually RMI invocation Consumer Distributed Systems: MOM & Shared Data Spaces 10

Discovery protocol The Lookup Service is essential for discovering other services To bootstrap the system (i.e. to discover the Lookup Services) a discovery protocol is used Each Lookup Service belongs to one or more groups Discovery is done broadcasting a simple UDP packet with the groups of interests In response to this UDP packet, a TCP connection is created and a ServiceRegistrar is transferred (a proxy of the Lookup Service) Distributed Systems: MOM & Shared Data Spaces 11

Discovery: Synch Helper Classes Discovery Classes implement the discovery protocol LookupLocator The simplest: it has a synchronous interface unicast discovery Takes a String url (es. jini://bla.bla.bla ) Distributed Systems: MOM & Shared Data Spaces 12

Discovery: Async Helper Classes More general with asynchronous interfaces LookupDiscovery(String[] groups) LookupLocatorDiscovery(String[] urls) LookupDiscoveryManager(String[] urls, String[] groups) It combines the behaviors of LookupDiscovery and LookupLocatorDiscovery Distributed Systems: MOM & Shared Data Spaces 13

Discovery: Async Helper Classes After the creation of a xxxdiscovery class you have to add a listener to receive notifications of DiscoveryEvent The listener must implement two methods void discovered(discoveryevent e) Brings information about all discovered Lookup Services void discarded(discoveryevent e) It is called after 4 missed multicast announcements e.getregistrars() returns an array of discovered Registrars Distributed Systems: MOM & Shared Data Spaces 14

Discovery: Join example After obtaining a ServiceRegistrar (a stub to the lookup service) we can join or lookup a service Lease period Service Id: null if the service was never exported before Stub of the object (through UnicastRemote Object.toStub) Optional attributes (service description) Distributed Systems: MOM & Shared Data Spaces 15

Discovery: Lookup example In the case I want to specify the service instance This is the interface to lookup These are the attributes describing the service Distributed Systems: MOM & Shared Data Spaces 16

Leasing Service registration, like many Jini operations is subject to leasing It s a way to provide self-healing in the network Whenever an operation which is subject to a lease is invoked The client requests a lease duration The server (lease grantor) could provide a lease with a shorter duration The client must check Distributed Systems: MOM & Shared Data Spaces 17

Leasing Lease interface renew cancel getexpiration A convenient way of dealing with leases is using a LeaseRenewalManager It offers methods for automatic leases renewal renewfor renewuntil Distributed Systems: MOM & Shared Data Spaces 18

JavaSpaces Sun OO Implementation of the Linda Model Fields are Java Object derived from the Entry object It is provided as part of the Jini Middleware Architecture Also supports Remote Event Notifications and Transactions API Write an item (OUT) Read any one item given a template (READ) Blocking or not blocking Is not possible to read ALL matching items Take an item (IN) Probing versions are named xxxifexists Distributed Systems: MOM & Shared Data Spaces 19

JavaSpaces API Entry read(entry tmpl, Transaction txn, long timeout) Read any matching entry from the space, blocking until one exists. Entry readifexists(entry tmpl, Transaction txn, long timeout) Read any matching entry from the space, returning null if there is currently is none. Entry take(entry tmpl, Transaction txn, long timeout) Take a matching entry from the space, waiting until one exists Entry takeifexists(entry tmpl, Transaction txn, long timeout) Take a matching entry from the space, returning null if there is currently is none Lease write(entry entry, Transaction txn, long lease) Write a new entry into the space EventRegistration notify(entry tmpl, Transaction txn, RemoteEventListener listener, long lease, MarshalledObject handback) When entries are written that match this template notify the given listener with a RemoteEvent that includes the handback object. Distributed Systems: MOM & Shared Data Spaces 20

Entry Entries in Jini are used both to describe services and to write in JavaSpaces. It s a Java tuple An Entry must implement the tagging interface Entry (which extends serializable) may extend the AbstractEntry which provides equals, hashcode and tostring (calls these on each internal field of the entry) Fields of an entry are those of its members which are of public reference (i.e., Object) type You cannot store primitive types in fields of an Entry, use wrapper objects instead private/default fields are not considered An Entry must have an empty constructor (may have any number of other constructors or methods) Each field is serialized separately, so references between two fields of an entry will not be reconstituted to be shared references, but instead to separate copies of the original object Distributed Systems: MOM & Shared Data Spaces 21

Matching of entries Entries can be used also as templates for matching other entries An entry matches an entry template if the class of the template is the same as, or a superclass of, the class of the entry and every non-null field in the template equals the corresponding field of the entry entries can match more than one template Distributed Systems: MOM & Shared Data Spaces 22

Entry Example Distributed Systems: MOM & Shared Data Spaces 23

Example: service discovery Distributed Systems: MOM & Shared Data Spaces 24

Example: writer Distributed Systems: MOM & Shared Data Spaces 25

Example: reader Distributed Systems: MOM & Shared Data Spaces 26

Example: reader (blocking) Distributed Systems: MOM & Shared Data Spaces 27

Example: reader with listener Includes a marshalled object. A copy will be returned in the event captured by the listener Distributed Systems: MOM & Shared Data Spaces 28

Example: reader with listener We use the MarshalledObject to distinguish among events generated for different calls to the notify() method Distributed Systems: MOM & Shared Data Spaces 29