22
1 The Jini Architecture

Azeem Seminar

Embed Size (px)

Citation preview

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 1/22

1

The Jini Architecture

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 2/22

What is Jini?

2

y  Jini is a distributed system architecture developed by Sun

Microsystems, Inc.

y Its main goal is ´network plug and playµ.

y  Jini is not an acronym, it·s coined by one of its designers--Bill

 Joy.

y You can think it as standing for ´Jini Is Not Initialsµ.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 3/22

Architecture Overview

3

Jini Services

Remote Method Invocation

TCP/IP

The Jini Architecture

Java Virtual Machine

Data Link Layer 

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 4/22

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 5/22

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 6/22

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 7/22

7

A simplified example :

A Printer

Proxy Object

Printer Attri butes

The Lookup Service

A Camera

The Lookup Service

Proxy Object

Printer Attri butes

A Camera

Proxy Object

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 8/22

8

The more complete scenario

1. A new printer is set up in the network.

2. The printer sends a ³looking for lookup services´ message to the local network.

3. Each lookup service on the network responds with a proxy for itself.

4. The printer registers its proxy o bject and attri butes with each lookup service

using the proxy of each lookup service.

5. A man with a digital camera comes into this network, and he wants to print out

a new picture.6. The camera sends ³ looking for lookup services´ messages to the local network.

7. Each lookup service in the network responds with a proxy for itself.

8. The camera searches for types of services it needs using the proxies of one or more

lookup services. The lookup service returns one or more matching proxy o bjects,

and the client distinguish them further  by their attri butes.

9. The exactly matched proxy is downloaded to the camera. Then the

camera  begins to use the proxy to interact with the printer to print the picture.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 9/22

What happens in a Jini environment?

9

For a service:

Discovery : sends a ³looking for lookup services´ message to all the local lookupservices and downloads their proxy o bjects.

Join : uses the downloaded proxy o bject to register its proxy o bject and attri butes

with each lookup service.

Renew : renews its registration at the lookup services.

For a client:Discovery : sends a ³looking for lookup services´ message to all the local lookup

services and downloads their proxy o bjects. Then it picks

up the service that it wants  by using the proxies of the lookup services.

For a lookup service:Here I am : sends a ³Here I am´ message periodically to the local network in case

that some services may be fail to register previously due to the network 

failure or some other reasons.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 10/22

The Service Lookup Process

10

y Service ID: each service, including the lookup service, has an IDthat is unique in the Jini environment.

y Group : a group can be represented by any arbitrary string.

y A client can use group to identify a set of services that it wishes to

look up.y The lookup service can use group to filter the lookup requests.

y A group with an empty string as name means ´public groupµ,

which will actually match all groups.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 11/22

The Service Lookup Process(cont·d)

11

y The Discovery Protocols : are used by a client or aservice to find out the lookup services and download

their proxy objects.

y The Leasing Mechanism : a lease is a period of time

during which the service is registered. If the leaseexpires and the service doesn·t renew it, the service will

 be discarded by the lookup service.

y The Join Protocol : is used by the service to register

itself with a lookup service.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 12/22

The Discovery Protocols

12

y

Multicast Request Protocoly Unicast discovery protocol

y Multicast Announcement Protocol

Three Protocols are used in the discovery phase:

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 13/22

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 14/22

14

The Discovering Entity The Lookup Service

2. The discovering entity first

sets up a TCP server.

The multicast response service

1. Construct a multicast UDP

socket, listening to the multicast

request.

3. Constructs a multicast UDP

socket, then sends its request

for lookup services to the network.

4. If the DE¶s groups match the

groups to which it provides services,it connects to the DE¶s multicast

response server, and passes its proxy

o bject to the DE.

The multicast response service

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 15/22

15

The Unicast Discovery Protocol

By multicast, a discovering entity can only find out the lookup

services in the local network.

What if a user want to access a Jini service in another 

network? Use the Unicast Discovery Protocol! The client needs to  be told a bout the location of the remote

lookup service.

Then the client directly esta blishes the TCP connection to the

lookup service and downloads the lookup service¶s proxy

o bject.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 16/22

16

The Multicast Announcement Protocol

The Multicast Announcement Protocol is initiated by the

lookup service to announce its existence.

It also uses 2 connections: one is the multicast UDP to send the

³Here I am´ message to the network, the other is a TCPconnection to wait for the discovering entity to esta blish a

download connection. In fact, this TCP connection is the same

connection as used in the Unicast Discovery Protocol.

It uses the TCP connection to transfer the proxy o bject of the

lookup service to the discovering entity.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 17/22

17

The Discovering Entity The Lookup Service

1. Esta blishes TCP unicast

discovery server.

The unicast discovery server 

2. Constructs a UDP multicast

socket, periodically sends out

the ³Here I am´ message.

1.Esta blishes a set of service IDs

of lookup services from which it

already heard, then constructs

socket waiting for the arriving of 

the multicast announcement.

Service IDs

2. For each announcement received,

it determines whether the service ID

is already in the set and whether it is

interested in the groups of the lookup

service.

3. If the service ID isn¶t in the setand it is interested in the groups, it

connects to the unicast server to get

the proxy of the lookup service and

then add the new ID into the set.

The unicast discovery server 

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 18/22

The Leasing Mechanism

18

y When a service registers with a lookup service, it gets back a lease on its

presence in the lookup service.y If a service wants to maintain its presence, it must periodically renew the

lease at the lookup service.

y Any network or host failure will force the removal of the unreachable

services, which guarantees that the status of the network is almost alwayscurrent.

y It·s a self-healing mechanism. For example, when a network failure isolates

a service from a lookup service, the service will be evicted from the

lookup service because it can·t renew its lease. And when the network is

fixed, the service will receive a ´Here I amµ message, and then it can join

the lookup service again.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 19/22

The Join Protocol

19

A service must maintain certain items of its state. These items areas follows:

1. Its service ID : A new service will not  be assigned a service ID until it is

started for the first time. After a service has  been assigned a service ID, it

must continue to use it across all lookup services.

2. Set of attributes : used to distinguish the service from other services.

3. Set of groups : the groups that this service wishes to participate.

4.Set of specific lookup services : the lookup services that this service hasregistered with. ( by remem bering their service IDs)

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 20/22

The Join Protocol(cont·d)

20

3. The Join Protocol happens after the discovery process, and isaccomplished  by using the downloaded proxy of the lookup service.

2. For example, if a service is asked to change the set of attri butes

with which it registers itself, it first modifies the set of attri butes inits storage, then it performs the requested change at each lookup

service with which it is registered.

1. The Join Protocol is used to register/unregister a service with alookup service, or to maintain those items of its state, such as

changing its groups, attri butes, etc.

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 21/22

8/8/2019 Azeem Seminar

http://slidepdf.com/reader/full/azeem-seminar 22/22

22

Thank you!