1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems...

29
1 Jini Tutorial, Part 2 Jini Overview

Transcript of 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems...

Page 1: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

1

Jini Tutorial, Part 2

Jini Overview

Page 2: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

2

Tutorial outline Part 1 Introduction

Distributed systems Java basics Remote Method Invocation (RMI)

Part 2 Overview of Jini Goals Architecture Basic concepts, protocols

Part 3 Jini Programming

Part 4 Advanced topics Mobile Jini access Adaptive user interfaces Security

Page 3: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

3

Why Jini?

Distributed computing is more difficult than local computing because of: Network latency, Concurrency issues, Memory management, Partial failure.

Page 4: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

4

Jini goals Jini™ Network Technology by Sun Microsystems “Plug-and-use”

A device should instantly usable when plugged into the network, just like a phone set – no installation, etc should be required

Reliable service-based architecture Spontaneous networking based on discovery and

mobile code Self-healing Erase the distinction between hardware and software

(everything is a service) Protocol-independence

To make writing distributed programs easier.

Page 5: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

5

Properties Based on the Java programming language.

Homogeneous network Architecture independence Dynamic environment

Programming interfaces designed for robustness.

Services may come and go without administration.

Federation, not central control. Jini can be used with both hardware as well as

software services: Everything is represented by Java Objects. Everything is located and accessed through Java

Interfaces.

Page 6: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

6

Tutorial outline Part 1 Introduction

Distributed systems Java basics Remote Method Invocation (RMI)

Part 2 Overview of Jini Goals Architecture Basic concepts, protocols

Part 3 Jini Programming

Part 4 Advanced topics Mobile Jini access Adaptive user interfaces Security

Page 7: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

7

Key participants Service

A service is an entity that another program, service or user can use. It can be a piece of computation, a hardware device or software.

Client A Jini device or component that becomes the

member of the federation in order to use a Jini service.

Lookup Service The central element of a Jini federation. The

lookup service (also known as the service locator or service registrar) keeps track of the services offered in the federation.

Repository of available services. Stores each service as Java objects. Clients download services on demand.

Page 8: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

8

Basic terms Spontaneous networking

Communication is established dynamically without installing drivers and carrying out manual configuration

Federation A set of software components and devices creating a distributed

system that are part of a Jini network at a given time. Discovery

The mechanism used to locate lookup services in order to advertise a new service in the network or find a service for use.

Leasing Jini services grant resource usage in a time-based manner. If the

period of the grant (lease) is not renewed before its expiration, the grant will be withdrawn at the end of the period.

Distributed event Components of a Jini system can notify each other when some

change in their state occurs. Transaction

Page 9: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

9

Jini Technologies

Page 10: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

10

Jini Architecture

SPARC

SolarisSolaris

Java

PowerPC

SolarisMac

Java

x86

Windows

Java

RMI

Discovery/Join

Lookup

Applications JavaSpaces Other services

Jini

Network services

Page 11: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

12

Jini Operation

The fundamental behaviour is defined by three protocols

Discovery – how to locate the Lookup Service Join – how to register with the LS and export services Lookup – how to find suitable services

Main operation steps Services export their services (in the form of Java

objects) Clients locate services and download objects or

execution Client-Service interaction (formation of a federation)

is governed by need

Page 12: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

13

Jini Operation (cont’d) Lookup services are dynamically discovered by

clients and services Services register service proxies in JLUSs Clients lookup and download service proxies from

discovered JLUSs by interface and/ or attributes

Jini Client

Jini Client

Jini ServiceJini Service Lookup Service A

Lookup Service A

Lookup Service B

Lookup Service B

ServiceItem

ServiceID serviceID

Object service

Entry[] attributeSets

backend service proxy

template

Page 13: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

14

LUS 6: Aut, KNT

LUS 5: IRT, KNT

LUS 1: IRT

Group IRT Group Aut

LUS 2: IRT

LUS 3: Aut

LUS 4: Aut

The notion of groups

Group KNT

Page 14: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

15

Tutorial outline Part 1 Introduction

Distributed systems Java basics Remote Method Invocation (RMI)

Part 2 Overview of Jini Goals Architecture Basic concepts, protocols

Part 3 Jini Programming

Part 4 Advanced topics Mobile Jini access Adaptive user interfaces Security

Page 15: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

16

The discovery protocol Two forms of discovery

Multicast, using UDP multicast Finding services at unknown but multicast-reach

locations using group names Unicast, using TCP/IP

Finding services at known locations URL: jini://hostname:port/

Forms Client discovery

At startup; problem with latecomer services Service announcement

At startup; problem with latecomer clients

Page 16: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

Multicast discovery protocollookup servicediscovering entity

multicast request

client

multicast response

server

Jini Specification:The multicast request protocol is employed by entities that wish to discovernearby lookup services. This is the protocol used by services that are startingup and need to locate whatever djinns happen to be close. It can also be used to support browsing of local lookup services.

multicast request server

multicast response

client

Multicast Request Service======================Transport protocol: Multicast UDPRequest Packet: < = 512 bytes---------------------------------------- contains:- protocol version [ currently 1]- port to contact by responders- groups of interest- known lookup services [serviceIDs, these should not respond]

Multicast Response Service=======================TCP service

controller

Uses TCP ServerSocket

serviceID :ServiceID

Uses Datagram socket

controller

Multicast settings==============TTL = 15multicast request address: 224.0.1.85multicast announcment address: 224.0.1.84port = 4160

create

create

create

create

{repeat after 5 sec delay up to 7 times}

*create and send multicast packets

[if (should respond)]:create

connect and send response (ServiceRegistrar)

remove

Page 17: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

Multicast announcement protocollookup service

Jini Specification: The multicast announcement protocol is provided to allow lookup servicesto advertise their existence. This protocol is useful in two situations. Whena new lookup service is started, it might need to announce its availabil ity topotential clients. Also, if a network failure occurs and clients lose track of alookup service, this protocol can be used to make them aware of its availabilityafter network service has been restored.

controller

multicast announcement

client

multicast announcement

server

Announcement Packets:===================Transport : Multicast UDPlenght: < = 512 bytes-------------------------------------- contains:- protocol version [= 1]- host for unicast discovery- port to connect to- service ID of originator- count of groups- groups represented by originator

controller

unicast discovery

server

serviceID :ServiceID

unicast discovery

client

create

create

create

{repeat with 120 sec delays}

send announcement packets

[if new service of interest]:create

start unicast discovery

Page 18: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

Unicast discovery protocollookup servicediscovering entity

controller controller

TCP socket

lookup locator

:LookupLocator

server socket

Object

create

create

getRegistrar

create

send unicast discovery request

unicast response (registrar proxy)

Page 19: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

20

Join protocol (services) Wait randomly at startup

Up to 15 sec Perform unicast discovery with known LUSs If groups ≠{} perform multicast for given

groups Register with discovered and/or announced LUSs

Perform periodic lease renewal On connection failure

Re-register with persistent LUSs Forget multicast discovered ones, wait for

announcement Making changes

Attribute change with all registered LUSs Register/unregister with specific LUSs Join/leave groups

If a service is asked to join a group, it adds the name of that group to the persistent set of groups to join and either starts or continues to perform multicast discovery using this augmented group.If the service is requested to leave a group, the steps are a little more complex:1. It removes that group from the persistent set of groups to join.2. It removes all lookup services that match only that group in the set of groups it is interested in from the set it has discovered using multicast discovery, and unregisters from those lookup services.3. It either continues to perform multicast discovery with the reduced set of groups or, if the set has been reduced to empty, ceases multicast discovery.

Page 20: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

21

Lookup protocol

Client creates template Describes the type of service sought

after Sends template to LUS LUS performs template matching LUS returns result

1 or more ServiceItem objects

Page 21: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

22

Matching Strict matching

Using marshalled objects Comparing

fields

Match if A) identical serviceIDs (tmpl can be null) and B) item service is instance of every tmpl service

types and C) item attributes contain at least one match for

each attribute in tmpl

ServiceID

Object implementing interfacesSet of attribute objects

ServiceItem

ServiceID

Set of service interfaces Set of attribute objects

ServiceTemplate

Page 22: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

23

Examples

1

Printer

Location(VE,IRT)PrinterProp(15,colour)

Service2

null null

Template 1

null

null null

Template 2

null

Fax null

Template 3

null

Printer null

Template 4

null

Printer Location(VE,KNT)

Template 5

2

Printer

Location(VE,IRT)PrinterProp(null, colour)

Template 6

Page 23: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

24

Leasing

Problem Partial failure in distributed systems can

lead to unchecked resource consumption. Traditional solution: system

administration: Error-prone, Costly, Only happens when it is too late.

Page 24: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

25

What are Leases? Time-based grants of resources or

services. Provides a method of managing

resources in an environment where network failures can, and do, occur

Loose contracts between grantor and holder.

Negotiated for a set period of time. Can be shared or exclusive.

Page 25: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

26

Distributed events in Jini

Enables Java event model to work in a distributed network.

Register interest, receive notification.

Allows for use of event managers. Can use numerous distributed

delivery models: Push, pull, filter...

Uses leasing protocol.

Page 26: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

27

Transaction model in Jini

Designed for distributed object coordination: light weight, object-oriented.

Supports: Nested transactions; Various levels of ACID properties (Atomicity,

Consistency, Isolation, Durability). Uses leasing protocol. Implemented in Transaction Manager

service – another Jini service (mahalo).

Page 27: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

28

Nested Transactions

Page 28: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

29

More Information

The Jini Specification Home pages

www.sun.com/jini www.jini.org

Online tutorials pandonia.canberra.edu.au/java/jini/tutorial/

Jini.xml www.oreilly.com/catalog/jininut/chapter/

ch04.html www.eli.sdsu.edu/courses/spring99/cs696/

notes/index.html

Page 29: 1 Jini Tutorial, Part 2 Jini Overview. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview.

30

Books (not all)