JavaSpaces Prabhaker Mateti Wright State University.

Slides:



Advertisements
Similar presentations
The Jini Technology Lookup Service. How Does It Work Services and clients find a lookup service using the discovery protocol Services advertise themselves.
Advertisements

1 Jini Tutorial, Part 3 Jini Programming. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2.
Jini Tutorial, Part 2 Jini Overview.
JINI Network Technology
Mini project /2 Jini - a new computing paradigm.
JavaSpaces and TSpaces Theresa Tamash CDA 5937 November 4, 2002.
JINI Shashwat Shriparv InfinitySoft.
Linda Coordination Language Presented by Tae Ki Kim
THE JINI TECHNOLOGY Alessio Zumbo
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
C# and Windows Programming Application Domains and Remoting.
Advanced Programming Rabie A. Ramadan Lecture 4. A Simple Use of Java Remote Method Invocation (RMI) 2.
Introduction to Jini & JavaSpaces
Notes to the presenter. I would like to thank Jim Waldo, Jon Bostrom, and Dennis Govoni. They helped me put this presentation together for the field.
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.
1 HANDOUT 14 Remote Method Invocation (RMI) BY GEORGE KOUTSOGIANNAKIS THIS DOCUMENT CAN NOT BE REPRODUCED OR DISTRIBUTED WITHOUT TH E WRITTEN PERMISSION.
CS 603 Jini April 10, What is Jini? Java Middleware Tools to construct federation –Multiple devices, each with Java Virtual Machine –Multiple services.
Distributed Service Architectures Yitao Duan 03/19/2002.
1 CS 194: Distributed Systems Distributed Coordination-based Systems Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering.
Introduction to Remote Method Invocation (RMI)
Parallel Computing using JavaSpaces -Presented by Shilpi Basak Advisor: Prof: Dick Steflik.
490dp Prelude I: Group Membership Prelude II: Team Presentations Tuples Robert Grimm.
Jini Connection Technology Kaushik Lahoti. Jini: A Vision n Areas to focus on –Simplicity –Reliability –Scalability.
TupleSpaces Revisited: Linda to TSpaces Ben Y. Zhao 13 July, 1998 UC Berkeley Computer Science Division.
Presented by Mark Miyashita
Java RMI Essentials Based on Mastering RMI Rickard Oberg.
Introduction - What is Jini Technology?
Nov 6, 2000CS851 Ubiquitous Computing1 The Jini Architecture Speaker: Weisheng Si Dept. of Computer Science University of Virginia.
January 26, Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
January 26, Bob Scheifler Copyright 1999 Sun Microsystems, Inc., all rights reserved. Jini™ Lookup Service Bob Scheifler Senior Staff Engineer Sun.
Sun’s Jini Lab 2 Service Registration Client Lookup.
A Look at Jini Jian He Roy Patrick Tan. Outline History Design Goals An Example Basic Components Top View Infrastructures --- Proxies, Discovery/join.
JavaSpaces TM By Stephan Roorda Source: JavaSpaces specification.
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.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
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.
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.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Distributed Systems Principles and Paradigms Chapter 12 Distributed Coordination-Based Systems 01 Introduction 02 Communication 03 Processes 04 Naming.
1 Lecture 16 Jini Technology Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology
JINI Design and Principles Ranjita Bhagwan CSE225: High-Performance Distributed Computing.
Introduction to Java Beans CIS 421 Web-based Java Programming.
Distributed Coordination-Based Systems Adapted from: "Distributed Systems", Tanenbaum & van Steen, course slides.
Hwajung Lee.  Interprocess Communication (IPC) is at the heart of distributed computing.  Processes and Threads  Process is the execution of a program.
Netprog: Corba Object Services1 CORBA 2.0 Object Services Ref: The Essential Distributed Objects Survival Guide: Orfali, Harky & Edwards.
JavaSpaces ™ Nati Shalom CTO GigaSpaces Technologies.
1 JSK 1.1 A practical Approach Contents –Working with JSK 1.1 –Jini environments –Writing Jini software revisited –Important software packages in the JSK.
JINI Coordination-Based System By Anthony Friel * David Kiernan * Jasper Wood.
Jini Architecture Introduction System Overview An Example.
Jini Architectural Overview Li Ping
Remote Method Invocation A Client Server Approach.
1 Jini Transaction Part II Daniel Müller Marcel Ziswiler Seminar Informations- & Kommunikationssysteme.
January 26, Ken Arnold Copyright 1999 Sun Microsystems, Inc., all rights reserved.
Jini Technology 제 1 회 한국 자바 개발자 컨퍼런스 발표자 : 강신동 Mobile : 소속 : ㈜ idosi.com 대표이사 주최 : JavaCommunity.Org.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
January 26, Ann Wollrath Copyright 1999 Sun Microsystems, Inc., all rights reserved. Java ™ RMI Overview Ann Wollrath Senior Staff Engineer Sun Microsystems,
Java Distributed Object System
Java Distributed Computing
Remote Method Invocation
Object Spaces 9/22/2018.
Bina Ramamurthy Chapter 9
An Introduction of Jini Technology
Bina Ramamurthy Chapter 9
Bina Ramamurthy Chapter 9
JINI ICS 243F- Distributed Systems Middleware, Spring 2001
Distribution Infrastructures
Java Remote Method Invocation
Presentation transcript:

JavaSpaces Prabhaker Mateti Wright State University

Feb 2002Mateti on "JavaSpace"2 Ack Ken Arnold Jan Newmarch Susanne Hupfer And many other sources on the Web

Feb 2002Mateti on "JavaSpace"3

Feb 2002Mateti on "JavaSpace"4 public interface JavaSpace public interface JavaSpace { Lease write(Entry entry, Transaction txn, long lease); Entry read(Entry tmpl, Transaction txn, long timeout); Entry readIfExists(Entry tmpl, Transaction txn, long timeout); Entry take(Entry tmpl, Transaction txn, long timeout); Entry takeIfExists(Entry tmpl, Transaction txn, long timeout); EventRegistration notify(Entry tmpl, Transaction txn, RemoteEventListener ln, long lease, MarshalledObject handback); Entry snapshot(Entry e) } //throws clauses not shown

Feb 2002Mateti on "JavaSpace"5

Feb 2002Mateti on "JavaSpace"6 MP3Request implements Entry public class MP3Request implements Entry { public String channelName; // recipient of the request public Integer position; // position # of request in channel public String inputName; // file path public byte[] data; // content of the file public String from; // who sent the request public MP3Request() {} public MP3Request(String channelName) { this.channelName = channelName; } public MP3Request (String channelName, Integer position) { this.channelName = channelName; this.position = position; } public MP3Request(String channelName, Integer position, String inputName, byte[] data, String from) { this.channelName = channelName; this.position = position; this.inputName = inputName; this.data = data; this.from = from; }

Feb 2002Mateti on "JavaSpace"7 From Jini … import net.jini.transaction.*; import net jini.event.*; import net.jini.lease.*;

Feb 2002Mateti on "JavaSpace"8 JavaSpaces Technology basis Built on core JDK facilities – RMI – Object serialization Part of Sun’s Jini package – Leasing – Transaction – Distributed events

Feb 2002Mateti on "JavaSpace"9 Jini JavaSpaceOther Lookup Service Discovery/Join Java RMI … services …

Feb 2002Mateti on "JavaSpace"10 JavaSpace v. Linda write: put an entry in the space (out) read: return a matching entry from the space (rd) take: remove a matching entry from the space (in) notify: send event when a matching entry is written (?) JavaSpace has No Linda eval()

Feb 2002Mateti on "JavaSpace"11 JavaSpaces architecture Entry/Template Serialization JavaSpace Scenario JavaSpaces/JavaSpace server JavaSpace Interface

Feb 2002Mateti on "JavaSpace"12 JavaSpace Service A simple service for distributed computing A shared object repository – Persistent – Template-matching lookup – Transactions (multi-space) Stores entries (tuples of objects) – Distributed (RMI-based) – Concurrent What a JavaSpace service isn't – A relational database – An object oriented database

Feb 2002Mateti on "JavaSpace"13 Why Use a JavaSpace? Cooperative, loosely-coupled systems scale well

Feb 2002Mateti on "JavaSpace"14 JavaSpaces Suitability JVM – All users should link to a JVM – use Java RMI – Transport among JVMs via JINI Interoperability – interoperable with other language – via RMI/IIOP and CORBA

Feb 2002Mateti on "JavaSpace"15 JavaSapces Concepts: A mechanism for distributed computing dynamic sharing, communication and coordination of Java Objects Loosely coupled, cooperative marketplace model – producer store objects in the space – consumer lookup and take objects from the space 100% pure Java language based

Feb 2002Mateti on "JavaSpace"16 JavaSapces Concepts: A networked repository for Java Objects Entries Store Entries (Serialized Java objects) Both data and behaviors Templates Lookup entries by using Templates Type matching (same class?) Value matching: lookup and compare the specific fields

Feb 2002Mateti on "JavaSpace"17 Service Provider Implements the objects that provide a service Finds the lookup services Registers the service object with lookup services Service object gets downloaded to clients A typical service object is a proxy

Feb 2002Mateti on "JavaSpace"18 A Service Provider Example public class AServer implements DiscoveryListener { protected LeaseRenewalManager lm = new LeaseRenewalManager(); public static void main(String argv[]) { new AServer(); Thread.currentThread().sleep(Lease.FOREVER); } public AServer() { LookupDiscovery di = new LookupDiscovery(LookupDiscovery.ALL_GROUPS); di.addDiscoveryListener(this); } public void discovered(DiscoveryEvent evt) { ServiceRegistrar rg = evt.getRegistrars()[0]; ServiceItem item = new ServiceItem(null, new AServerImpl(), null); ServiceRegistration sr = rg.register(item, Lease.FOREVER); lm.renewUntil(sr.getLease(), Lease.FOREVER, this); }

Feb 2002Mateti on "JavaSpace"19 Lookup Services Listening on port 4160 Unicast TCP; Multicast UDP Sends a registrar object to requestor Registering == storing a copy of the service object in the lookup service 4160 == 0xCAFE – 0xBABE

Feb 2002Mateti on "JavaSpace"20 Entry Class Implements interface: public interface Entry extends java.io.serializable { } All fields must be public Fields must be objects, not builtins (no int, etc.) Must have a public null-arg constructor

Feb 2002Mateti on "JavaSpace"21 An Example Entry class User implements Entry { public String login; public String homeHost; public String fullName; public Long lastLogin; //... }

Feb 2002Mateti on "JavaSpace"22 Entry Methods write -- put a copy of entry into the space read, readIfExists -- return a matching entry from the space take, takeIfExists -- remove the matching entry from the space notify -- send an event when the matching entry is written snapshot -- return another entry object that contains the snapshot of the original one

Feb 2002Mateti on "JavaSpace"23 Lease write (Entry e, Transaction t, long lease) Write a copy of e into Space returns a Lease object limited persistence with time-outs exceptions

Feb 2002Mateti on "JavaSpace"24 Entry snapshot (Entry e) Returns an Entry object with a copy of the original unmodified object Modification on the original entry will not affect snapshot Works only within the same JavaSpaces Server where it is generated

Feb 2002Mateti on "JavaSpace"25 Template Entry object Some/all fields set to specific values Null fields act as wildcards Exact value match of each non-null field

Feb 2002Mateti on "JavaSpace"26 Template Type matching and subtype matching Only public fields are considered for matching Fields should refer to serializable objects Fields must have properties

Feb 2002Mateti on "JavaSpace"27 Entry Matching Matching requires a template The service is searched for one entry that... Is at least the template's type Has all values matching

Feb 2002Mateti on "JavaSpace"28 Templates match entries iff … each field in template is either null or match the entry field via MarshalledObject.equals. That is, the serialized forms of the objects match exactly.

Feb 2002Mateti on "JavaSpace"29 public Entry read (Entry e, Transaction t, long timeout) A copy of the matching entry is returned. read vs. readIfExists: read will wait until a match is found or until transaction settles, up to time out period Null returned, if nothing matches

Feb 2002Mateti on "JavaSpace"30 Entry take(Entry tmpl, Transaction t, long timeout) Matching object is removed from space RemoteException: Entry may or may not be removed successfully Other Exceptions mean failure Subtype matching: returns may be more than anticipated

Feb 2002Mateti on "JavaSpace"31 Serialization Entries are not stored in JavaSpaces Serialized form of the class and fields java.rmi.MarshalledObject MashalledObject.equals() Field in template has null value as wildcard set fields/un-set fields Object graph map reference

Feb 2002Mateti on "JavaSpace"32 notify EventRegistration notify(Entry tmplt, Transaction t, RemoteEventListener l, long lease, MarshalledObject handback) RemoteEvent RemoteEventListener EventRegistraion{ evID fromWhom seqNo } retry to notify listeners

Feb 2002Mateti on "JavaSpace"33 JaveSpaces Scenario JavaSpaces RMI Leasing Distributed Event Transaction Entry

Feb 2002Mateti on "JavaSpace"34 Leasing Used in distributed environments to solve partial failure of resources and services Resources are leased and freed when the time of the lease expires Get rid off debris easily Negotiation among related parties Lease can be renewed or canceled

Feb 2002Mateti on "JavaSpace"35 Lease “ a time period during which the grantor of the lease insures that the holder of the lease will have access to its resources.” Typical Grantor: lookup service Typical Grantee: component

Feb 2002Mateti on "JavaSpace"36 package net.jini.core; public interface Lease { void cancel() throws UnknownLeaseException,java.rmi.RemoteException; long getExpiration(); void renew(long duration) throws LeaseDeniedException, UnknownLeaseException, java.rmi.RemoteException; }

Feb 2002Mateti on "JavaSpace"37 ACID properties of transactions Atomicity – All the operations of a transaction must take place, or none of them do Consistency – The completion of a transaction must leave the participants in a ``consistent'' state. Isolation – The activities of one transaction must not affect any other transactions Durability – The results of a transaction must be persistent

Feb 2002Mateti on "JavaSpace"38 Two-phase commit protocol Participants tentatively carry out the operations. All participants then vote. If all agree, the transaction commits. If any disagree, transaction aborts in all.

Feb 2002Mateti on "JavaSpace"39 Jini Transaction Two phase commit model Transaction ID supplied by the manager Based on RMI for communication Dependent on Leasing Mahalo transaction manager is part of Jini

Feb 2002Mateti on "JavaSpace"40 Distributed Event Events in multi-address spaces Desired delay Network failure/Delay Third-party agents perform notification Non-Java third-party agents

Feb 2002Mateti on "JavaSpace"41 Multiple JavaSpaces Multiple JavaSpaces cooperate, and transactions span multiple spaces. Partitions provide minimal protection.

Feb 2002Mateti on "JavaSpace"42 Scale It Up

Feb 2002Mateti on "JavaSpace"43 JavaSpaces is not a database All entries are copies of original objects No general query language No way to return sets of objects Not a transparent persistence mechanism (can not modify data) Understand entry by type and serialized fields

Feb 2002Mateti on "JavaSpace"44 Applications (Model) Identities JavaSpaces server JavaSpaces server JavaSpaces server Client Event Catcher Transaction notify write take write writeEvent write read Security Check proxy notify

Feb 2002Mateti on "JavaSpace"45 An application scenario: Stock trading system Entry fields: – securities, owners price offers, quantities,... GUI: – applets Many sellers and buyers can be involved – concurrent accesses are handled by the space buyer seller JavaSpaces Server entry Write bid entry Write Notify Live feed applet read graphic applet

Feb 2002Mateti on "JavaSpace"46 Applications Workflow systems Customer management systems Supply chain management Auction systems Trading service Agent systems Publish and subscribe service …...

Feb 2002Mateti on "JavaSpace"47 JavaSpaces Server Not a remote interface invocations of methods of JavaSpace throw RemoteException JavaSpaces server exports objects implementing javaspace interface to clients

Feb 2002Mateti on "JavaSpace"48 JavaSpace Server JavaSpace Server Interface JavaSpace ServerClient

Feb 2002Mateti on "JavaSpace"49 Entry implementation Example import net.jini.space.Entry public class MyEntry implements Entry { public String name; public GIFImage value; public MyEntry(){ }

Feb 2002Mateti on "JavaSpace"50 Sample implementation Requirements Entry implementation Sample invocation

Feb 2002Mateti on "JavaSpace"51 Sample invocation import net.jini.impl.outrigger.binders.RefHolder public class HelloWorld { public JavaSpace getSpace() { RefHolder rh = (RefHolder) Naming.lookup(“JavaSpace”); JavaSpace js = (JavaSpace) rh.proxy(); }

Feb 2002Mateti on "JavaSpace"52 Sample invocation JavaSpace space = getSpace(); MyEntry e = new MyEntry(); e.name =“Duke”; e.value= new GIFImage (“dukeWave.gif”); space.write(e, null, 60*60*1000);

Feb 2002Mateti on "JavaSpace"53 Supporting packages Leasing Transaction Distributed Event/Listener

Feb 2002Mateti on "JavaSpace"54 Third-party agents Obj1 Obj3 Obj2 Obj4 Server

Feb 2002Mateti on "JavaSpace"55 Jini lookup service: reggie Reggie is an activatable process It just registers itself with rmid Rmid activates it as necessary

Feb 2002Mateti on "JavaSpace"56