Title: Technical Stream Session 7: Resource Discovery and Jini
1Technical Stream Session 7 Resource Discovery
and Jini
Distributed Systems
2Overview of the Session
- Introduce the Jini platform
- Provide motivation for a new distributed services
technology - Illustrate example Jini scenarios
- Discuss approaches to resource discovery
- Examine the Jini architecture
- The discovery, join and lookup protocols
- Jini proxy-based service interaction
- Jini service leases
- Programming Jini services and applications
- Examples of advertising and searching for Jini
applications
3Why do we need Jini?
- The motivation for Jini is to provide Plug and
Play of Network Services - Form a community of devices, users and services
without pre-planning, installation or human
intervention - Create spontaneous distributed applications
- Example network services
- Storage
- Computation
- Hardware device
- Software service
- User
- Network-centric rather than disk-centric
applications
4Plug and Play Scenarios
Camera finds light switch to turn on before
taking picture
Camera finds disk drive to save pictures
Camera finds network printer to print pictures
- Common themes
- Service/Resource discovery
- Service interaction
5What is Jini
- A runtime infrastructure to add, remove, locate,
and access network services - Developed by Sun Microsystems
- Adopts the Java programming model One language
everywhere - Utilises the benefits of mobile code in Java
- Jini supports
- Discovery of Jini services
- Find me a service that matches my requirements
- Service interaction
- Dynamic use of a found service
- Services leases
- Track active Jini services. Services live for a
period of time - Distributed events
- Services notify interested services of changes in
their status
See lecture on mobile agents
6What is Resource Discovery?
- Find a resource that meets the application
requirements - Match resource type
- e.g. Printer, CPU, Coursework submission service
- Match attributes
- e.g. inkcolour, speedgt500MHz, course253
- Wildcard lookup
- Range queries over all known resources
- e.g. (ProcessorType) (Speed 300-500MHz)
- Well known problem in resource discovery
- An identical resource type and attribute match
may not match the semantic requirements - Ongoing research Semantic Web solutions
- Two styles of resource discovery
- Directory-based
- Multicast-based
7Directory-based Discovery
- Centralised directory services
- Service connects directly (using unicast
protocols) and sends service advertisement
information - Client connects directly and sends lookup
request, directory service responds - Good
- Scalablility
- Minimises network traffic about discovery
- Bad
- Requires third-party administration
- Cannot support spontaneous interaction
- Requires directory to be available in the network
- Clients and services must know the location of
the directory - Examples
- RMIRegistry, DNS, Lightweight Directory Access
Protocol (LDAP), and others
8Multicast-based Discovery
- Common multicast address
- Services listen for discovery requests sent by
clients directly - Respond if they have a matching services
- Good
- No third party administration
- Supports ad-hoc resource lookup
- Bad
- Additional Network traffic
- Client must deal with multiple results
- Examples
- Universal Plug and Play (UPnP)
- Service Location Protocol (SLP)
- Hybrid of the multicast and directory approach
9Joining and Using Jini Services
- Jini provides a suite of protocols to add,
locate, and interact with Jini services - Jini defines a discovery protocol to locate a
nearby Jini lookup service - Directory based discovery
- A Join protocol to enable a service to register
itself with a lookup service - A Lookup protocol to enable a client to query a
lookup service for available services - The result of lookup is a Jini service proxy
- Returns mobile code
- The client uses the proxy to interact directly
with the service
10The Jini Discovery Protocol
- All entities must find a Jini Lookup service in
the network - Either local to the network or remote
- Three alternative approaches
- Multicast dynamic discovery
- Unicast discovery
- Multicast announcement
- In each approach the Lookup Service returns a
ServiceRegistrar Proxy Object using RMI - This is the reference to do service advertisement
and service lookup
11Multicast Discovery Protocol
- Reasons for using multicast discovery
- Find a nearby lookup service
- Starting service has no knowledge of network
- The multicast discovery protocol
Discovering Entity
Lookup Server
1. Sets up a TCP server instance of the
multicast response service
2. Lookup servers run instances of the multicast
request service listens for requests from
discoverers
TCP response
UDP Multicast
3. Performs a multicast request to lookup services
4. Connects to the discoverers multicast
response server and sends a reference to itself
12Unicast Discovery Protocol
- Reasons for using unicast discovery
- Client knows location of a specific lookup
service - e.g. jini//lus.comp.lancs.ac.uk
- Client must access a Jini service in another
network - Multicast discovery only works in local network
- Unicast protocol
- Client directly establishes a TCP connection with
the lookup service and downloads the registrar
proxy
TCP connection established
Unicast request sent
Unicast response sent
Discovering entity
Lookup service
13Multicast Announcement Protocol
- Reasons to use multicast announcement
- Lookup services announce their existence
- E.g. when a new lookup service is started
- Recover from network failure
- Clients lose track of lookup service ? when
lookup service is restarted they are made aware
of its return - The Announcement protocol
Discovering Entity
Lookup Server
UDP Multicast
1. Listens on multicast announcement address
2. Sends a multicast announcement
TCP request - response
3. Performs unicast discovery
4. Sends response to unicast discovery
14The Join Protocol
- Allows the Jini service to advertise itself with
the Lookup Service - Invoke register() passing a ServiceItem object
and a lease duration
register(ServiceItem, long)
- ServiceItem Class
- ID for the service (automatically generated by
Lookup Service) - object implementing the Jini Service
- attributes for service - list of objects
15Leasing in Jini
- When Services die
- How do you stop their references accumulating in
the lookup servers? - Solution Leases
- A service is provided for a given amount of time
(LEASE) - Services must renew their leases
- Avoids third-party management for Lookup services
- Support failure detection
- Removes unreachable services
- Programming leases
- Services can use defaults or set manually
- Lease.ANY - the service lets the lookup service
decide on the time - Lease.FOREVER - the request is for a lease that
never expires - Avoid!!
16The Lookup Protocol
- The client creates a service template
- Contains the search query
- Combination of 3 parameters
- ServiceID, ServiceType (Class), attributes
- Invoke Lookup(ServiceTemplate) on the Lookup
Service - Via the registrar proxy
Lookup(ServiceTemplate t)
Jini Client (Consumer)
17Example Service Templates
- Search by attribute only
- Search for a service with attribute
- Name MyServer
aeAttributes new Entry1 aeAttributes0
new Name ("MyServer") template new
ServiceTemplate (null, null, aeAttributes)
- Search by service type
- Search for a service with a specific class
- Class HelloWorldService.class
Class types HelloWorldService.class templat
e new ServiceTemplate(null, types, null)
18Interacting with Jini Services
- Jini Service Proxies are of three types
- Proxy performs the service itself
- Code is self contained
- Does not require any remote interactions
- Proxy is an RMI stub for a remote service
- Minimal code only the interface to the remote
object - Client invokes operations on the proxy RMI used
to invoke operation on the services - Proxy is a smart adaptor
- Contains code to interact with the service
- Sockets
- CORBA
- Proprietary protocol
Client
Proxy
Service
19Jini in Full
7. Jini client uses Java proxy to communicate and
use the Jini service
Jini Client (Consumer)
Jini Services
6. Invokes lookup() on ServiceRegistrar to locate
desired service (returns Java proxy)
3. invokes register() on ServiceRegistrar object
to register service
2. receives a ServiceRegistrar object
5. receives a ServiceRegistrar object
1. Jini service discovers LUS
4. Jini client discovers LUS
LUS Jini Lookup Service
20Delving Deeper
- http//www.jini.org
- Community of Jini developers
- Sample code downloads, Jini articles, and blogs
- http//java.sun.com/developer/products/jini/
- Download the Jini platform from Sun
- Books
- Core JINI, W. K. Edwards, Prentice Hall
- Covers technical aspects of Jini
- JINI Example by Example, W.K. Edwards and T.
Rodden, Prentice Hall - Learn to program in Jini
21UPnP A Related Technology
- Universal Plug and Play (UPnP) from Microsoft
- Includes discovery, interaction, and event
notification - Based upon Web technologies (http, SOAP, XML)
rather than Java technologies - No mobile code
- Multicast based lookup
- XML descriptions of devices and services
- Matches DeviceType, ServiceType, and attribute
matches - Service interaction
- Via the SOAP protocol
22Expected Learning Outcomes
- At the end of this Unit
- You should understand why resource discovery is
important in distributed systems - You should know the different styles of resource
discovery available - You should know the key architectural features of
the Jini technology - You should know the benefits that Jini provides
distributed application developers