290 likes | 486 Views
Jini Tutorial, Part 2. Jini Overview. 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
E N D
Jini Tutorial, Part 2 Jini Overview
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
Why Jini? • Distributed computing is more difficult than local computing because of: • Network latency, • Concurrency issues, • Memory management, • Partial failure.
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.
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.
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
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.
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. • Distributedevent • Components of a Jini system can notify each other when some change in their state occurs. • Transaction
Jini Architecture Network services Applications Other services JavaSpaces Lookup Jini Discovery/Join RMI Java Java Java Solaris Mac Solaris Solaris Windows PowerPC SPARC x86
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
Lookup Service A ServiceItem ServiceID serviceID Object service Entry[] attributeSets Lookup Service B 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 Service backend service proxy Jini Client template
The notion of groups Group Aut Group IRT Group KNT LUS 3: Aut LUS 1: IRT LUS 5: IRT, KNT LUS 6: Aut, KNT LUS 4: Aut LUS 2: IRT
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
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
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 persistentset of groups to join and either starts or continues to perform multicast discoveryusing 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 ofgroups 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 ofgroups or, if the set has been reduced to empty, ceases multicast discovery.
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
ServiceItem ServiceTemplate ServiceID ServiceID Object implementing interfaces Set of service interfaces Set of attribute objects Set of attribute objects 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
Template 5 Template 4 Template 6 Template 3 Template 1 Template 2 Service null 2 null null null 2 1 Printer null Printer Fax Printer null Printer null null Location(VE,KNT) null null Location(VE,IRT)PrinterProp(null, colour) Location(VE,IRT)PrinterProp(15,colour) Examples
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.
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.
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.
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).
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