Jini TM Architecture Source : Sun Microsystems Inc., Jini TM Architecture Specification; .
A Look at Jini
-
Upload
walker-santiago -
Category
Documents
-
view
31 -
download
2
description
Transcript of A Look at Jini
![Page 1: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/1.jpg)
A Look at Jini
Richard Chapman
Sept. 30, 1999
![Page 2: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/2.jpg)
Jini Motivation
• Why must everyone be a sysadmin?
• Why can’t computers scale like the phone system: added complexity without added configuration work?
• Why can’t devices/services enter and leave the network without explicit reconfiguration?
![Page 3: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/3.jpg)
Jini Goals
• Very robust software infrastructure• No configuration/administration
required • Software must be evolvable• Devices can form spontaneous
communities
![Page 4: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/4.jpg)
Jini History
• Fulfillment of original Java goals of an environment for embedded systems (Oak, 1990)
• The word “Jini” does not stand for anything
• Went public too soon, NYT reporter John Markoff broke story in 1998
![Page 5: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/5.jpg)
Jini is intended to be used by:
• Information appliances (thin clients, set top boxes, PDA’s)
• Desktop machines can benefit from a reduction in sysadmin duties
• Enterprise systems (servers) also benefit
![Page 6: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/6.jpg)
Getting Jini
• Source code distributed under Sun community source license (open source)
• Need Java 2• Requires web server, RMI activation
daemon, lookup service• http://www.javasoft.com/products/
jini/
![Page 7: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/7.jpg)
Networked vs Distributed Systems
• Move the data or move the code?• Conventional wisdom: since code has
to be compiled and installed, move the data, and call a routine on the remote machine
• Thus: make the remote function call look like a local function call as much as possible (RPC, CORBA, DCOM)
![Page 8: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/8.jpg)
The network cannot be ignored
• Very high latency (orders of magnitude)
• High variability in latency (has a component failed or is the link just very slow?)
• New failure modes that do not exist on local machine (router down, nameserver crash, cable came loose)
![Page 9: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/9.jpg)
Handling Partial Failures
• Partial Failures do not exist on local machines -- you know the state, for better or worse
• Partial failures arise when some, but not all hosts, receive a message from a sender
• May be difficult for sender to detect which hosts received message
![Page 10: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/10.jpg)
Handling Partial Failures, Cont’d.
• Even if server can detect which hosts have not received a message, what does it do
• Can’t keep trying forever -- you run out of disk drives storing old messages you are trying to send
• Don’t want to give up and cut off the host that failed to get a message
![Page 11: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/11.jpg)
Why CORBA isn’t enough
• Ignores network performance issues (makes remote call look like local call)
• An add-on to existing languages (not all machines implement C++ the same way)
• Example problems: endianness, size of int, float, char, etc.
![Page 12: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/12.jpg)
Peter Deutch’s Seven Network Fallacies
• The network is reliable
• Latency is zero• Bandwidth is
infinite• The network is
secure
• Topology doesn’t matter
• There is one administrator
• Transport cost is zero
![Page 13: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/13.jpg)
Jini adopts the programming model of
Java• One lanuage everywhere• Data in the same format everywhoere
(objects represented by bytecodes) • Strongly typed interfaces• Separate interface and
implementation• Plus: a distributed storage model
based on Linda (Gelernter, Yale)
![Page 14: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/14.jpg)
Conventional wisdom is no longer valid.
• Code can easily move from machine to machine
• Servers can be dynamically updated
• Systems can evolve by updating interfaces with new code as needed, no need for recompilation
![Page 15: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/15.jpg)
Strong typing is important
• In Java, an RMI defines the interface, while in CORBA, an IDL description is a wrapper around the interface
• Polymorphism works in RMI -- you can define subinterfaces; you can pass an ojbect of a subtype to remote server and the subtype methods are appropriately used (doesn’t work in CORBA).
![Page 16: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/16.jpg)
Jini is built on Java RMI
• RMI = Remote Method Invocation
Public interface RemoteServer extends Remote {
public int getlength(String S) throws
RemoteException;
}
![Page 17: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/17.jpg)
Java RMI, cont’d
• If you change the (Java) interface declaration in Java, you are really changing the way the interface works
• If you change the Java interface declaration in a CORBA system, you just break the interface, since the Java interface is generated automatically from the IDL description
![Page 18: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/18.jpg)
Java RMI, cont’d
• Thus from a software engineering point of view, the CORBA implementation is more complicated and error-prone
• However, CORBA outperfromed RMI empirically (no longer true?)
• For enterprise solutions, CORBA is essential -- we will always need glue to connect heterogeneous systems
![Page 19: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/19.jpg)
Strong typing, cont’d
• “Remoteness” is inherently part of the interface, not an implementation detail
• Every interface must extend java.rmi.remote
• Permits a reasonable definition of equality for remote objects -- you care if the remote objects are the same, not the local stubs
![Page 20: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/20.jpg)
What Jini is not
• Jini is not a name server: lookup service is similar, but does more than provide references to objects
• Jini is not Java Beans: beans communication based on direct method invocation, not remote. Also, beans do not automatically become aware of each other as do Jini objects
![Page 21: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/21.jpg)
What Jini is not, cont’d
• Jini is not Enterprise Java Beans: Enterprise Java Beans function across multiple address spaces well, but they put Java wrappers around legacy systems
• Jini is not RMI: built on top of RMI• Jini is not a distributed OS
![Page 22: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/22.jpg)
Five Key Concepts of Jini
• Discovery• Lookup• Leasing• Remote Events• Transactions
![Page 23: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/23.jpg)
Discovery
• Services=Devices or Software• Services collect themselves into
communities• The resources available to a community
are kept track of by a lookup service• No one-to-one mapping between
communities and lookup services• Discovery=finding available lookup
services
![Page 24: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/24.jpg)
Discovery, cont’d
• Several discovery protocols• Multicast finds nearby lookup
services (on the same LAN)• Multicast Announcement declares
that a new lookup service has started up
• Unicast used to talk to a particular lookup service
![Page 25: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/25.jpg)
Lookup
• Lookup server does more than nameserver
• Nameserver provides pointers to objects when given names
• Lookup server does that also, plus supports searching for services that meet certain criteria, e.g. those that have a particular Java type
![Page 26: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/26.jpg)
Lookup cont’d
• Lookup returns a service item when queried successfully.
• Service item contains proxy object (local stub for remote object) and attributes that describe the service
![Page 27: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/27.jpg)
Lookup, cont’d
Lookup service
Service item
Proxy
attribute
attribute Service item
![Page 28: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/28.jpg)
Lookup, cont’d
• Downloadable proxy provided with each service item
• When any entity wants to use your service it downloads the proxy and runs it -- the proxy handles sending the remote server the necessary pieces
• Proxy can be used as a secure, network-aware device driver
![Page 29: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/29.jpg)
Proxy scenarios
• Proxy may perform the service by itself, without any remote method invocation
• Proxy may be an RMI stub that knows how to talk to a remote service (e.g. IMAP mail server)
• Proxy uses private communication protocol to talk to legacy (non-Java) systems.
![Page 30: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/30.jpg)
Using a Jini Service
Lookup service
Downloads proxy
Service Client
Client communicateswith service viaproxy
![Page 31: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/31.jpg)
“How does client x know to call method y?”
• Objects must have some understanding of the services they are going to use
• Industry will have to define a common set of standards for interfaces to things like cell phones, printers, scanners, digital cameras
• My opinion: these interfaces will need updating, and may prove to be Jini’s undoing
![Page 32: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/32.jpg)
Leasing
• Suppose a service provider dies at some point
• How do you keep dead services from accumulating in the lookup servers over time
• Solution: a service is only provided for a certain amount of time unless the provider re-registers it (renews the lease)
![Page 33: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/33.jpg)
Leasing, cont’d
• No sysadmin needs to comb through the lookup service database to remove long-dead services
• Cleans up partial failures• Similarly, resource is not granted
to a consumer for indefinite period, but “leased” for a finite time
![Page 34: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/34.jpg)
Leasing, cont’d
• Consumer must renew the lease if the resource continues to be needed
• Unreliable code thus does not do permanent damage -- after a while the resource is freed automatically
• No maintenance required of persistent storage
![Page 35: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/35.jpg)
Third party leasing
• Jini leases can be negotiated by a third party
• Example: long-lived but rarely active process such as monthly disk backup routine
• Example: process that does not want to be bothered with extra code complexity of lease management
![Page 36: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/36.jpg)
Delegation
• Similar to Java Beans delegation• Allows events to be handled by a
third party rather than the actual object to which the event was sent
![Page 37: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/37.jpg)
Lease mechanics
• Discovery returns an object that implements lookup interface (called ServiceRegistrar)
• Server calls method register() of ServiceRegistrar with service item object as argument -- describes the service to be registered
![Page 38: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/38.jpg)
Lease mechanics, cont’d
• Client calls ServiceRegistrar lookup() method to find if a service meeting its’ criteria is registered.
• Service registrar returns a service item object, whose proxy is then used to access object
• Lease is handled by an argument to register, which says how long (long int) the server plans to provide the service
![Page 39: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/39.jpg)
Lease mechanics, cont’d
• Only one round of negotiation needed for a lease
• Lease done in terms of duration, not absolute time
• Leasing is not garbage collection
![Page 40: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/40.jpg)
Events
• Used for asynchronous notification• Event is an object containing
information about external state change the recipient may be interested in
• Same as Java Foundation Classes and Java Beans model of events
![Page 41: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/41.jpg)
Remote Events
• Remote events may not arrive in order sent
• Remote events may not arrive at all• Remote events more expensive to
send than local events• What does sender do if receiver has
crashed -- keep trying? How long?
![Page 42: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/42.jpg)
Remote Events, cont’d
• Example: want to print an image taken with a digital camera to a printer
• Suppose digital camera is connected to network and there are no printers (want to “grey out” the print button on camera GUI)
• When a printer is connected, the cameras should be notified
![Page 43: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/43.jpg)
Remote events, cont’d
• RemoteEventListener() is a remote interface used by objects waiting for events
• Method notify() invoked via RMI by objects that want to send events
• Very simple: one class, one interface, one method. Contrast to Java Foundation Classes
• Jini can implement generic 3rd party event listeners (hard in JFC).
![Page 44: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/44.jpg)
Remote Events, contd
• Process interested in receving events leases that service just like any other
• Hence if a service dies, it is not sent events forever, only until its lease expires
![Page 45: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/45.jpg)
Transactions
• Used to handle partial failures -- gives a way of deducing state of the system after a partial failure
• Used to guarantee data integrity( atomicity, consistency, isolation, durability)
![Page 46: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/46.jpg)
Two-phase commit
• Transaction manager collects all constituent operations of a transaction
• Participants go to pre-commit status (compute all results they would compute if transaction were successful, but do not make them permanent)
• Send acknowledgement of successful transition to pre-commit status back to transaction manager
![Page 47: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/47.jpg)
Two-phase commit, cont’d
• If any participant fails, transaction manager instructs all components to abort, else notifies all to commit
• State of all components of system is predictable in the presence of failures
![Page 48: A Look at Jini](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813074550346895d9651c7/html5/thumbnails/48.jpg)
Jini implementation of two-phase commit
• All participants implement TransactionParticipant interface.
• Three methods: prepare(), commit() abort()
• Jini transaction manager doesn’t care how the participants implement the methods, it just steps through the protocol.