jini connection technology architecture overview · 2014. 12. 4. · 1 jini ™ connection...
TRANSCRIPT
1
Jini™ ConnectionTechnology
Architecture OverviewBill Day
Technology EvangelistSun Microsystems
Agenda
l Why Jini?l What is Jini?l Jini Architecture Overviewl The Detailsl Example Service Modelsl Subtopics on:uJavaSpaces™
uJini Surrogate ArchitectureuRelated Technologies
l Availability and Resources
2
Why Jini?
Distributed computing is moredifficult than local computingbecause of:
Why Jini?
l Network latencyl Concurrency issuesl Memory managementl Inevitable partial failure
3
Evolution of distributedcomputing
MessagePackets
MessagePackets
RemoteProcedure
Calls
RemoteProcedure
Calls
DistributedObject
References
DistributedObject
References
DistributedObjects
DistributedObjects
TCP/IP Sockets
C/C++Administrative ToolsFixed Topology
CORBA/IIOP or DCOMMultiple LanguagesAll Computation on ServerStatic Server Locations
RMI/IIOPJava™ OnlyDistributed Client/Server LoadDynamic Server Locations
Key insight: Remote increasingly looks local
What is Jini?
4
l Jini addresses the problems ofdistributed computing using a set ofsimple interfaces and protocols
l Jini enables spontaneous networks ofsoftware services (and devices) toassemble into working groups ofobjects, or Federations
l Jini enables self-healing when oneor more devices are removed fromthe Federation
l Jini builds on the Java™ 2 Platform
What is Jini™?
What is Jini™?
l Jini is usable for hardware as well assoftware servicesuEverything is represented by Java
Objects.uEverything is located and accessed
through Java Interfaces.
5
The Value of Jini™
l ConsumersuPlugging in networked devices and
application software is as simple asplugging in a phone today
l Service providersuSimplifies management of application
service delivery
The Value of Jini™
l Product manufacturersuOpens entirely new markets
(diagnostics, post-purchase upgradesand software enhancements, customercare)
l ProgrammersuSimplifies the task of writing distributed
applications by freeing them fromnetwork topology
6
Jini Architecture Overview
SPARC™ PPC x86
Solaris Mac Windows
Java Java Java
Lookup
JavaSpaces™ Other Services
JiniInfrastructure
JiniServices •••
Discovery/Join
RMI
TM
Jini™ Architecture Overview
7
Java Technology Features thatBenefit Jini™
Feature
Java Virtual Machine
Portable object code
Downloadable code
Unified type system
Benefit
Homogeneous network
Architecture independence
Dynamic environment
No impedance mismatch
Jini Extends the Java Platform
Jini
Java
ServicesInfrastructure Programming Model
Discovery
Lookup
ExtendedSecurity
Java VM
RMI
Security
Lease
Event
Transaction
Javatechnology-based APIs
Beans
Swing
JavaSpaces
TX Manager
OtherServices
EnterpriseJavaBeans™
Java Namingand DirectoryInterface™
JTS
8
The Details:Jini Infrastructure
Jini Lookup Service
l Repository of available servicesl Stores each service as Java objectsl Clients download services on demand
Lookup Service
(LUS)
Service Proxies
9
Using a Lookup service
JiniLookupService1. Java.ty
pe
2. Service
O
bject
Client 3. Request
4. Response
Device or Service
Lookup service
l May be federated with other lookupservices
l Lookup service interface provides:uRegistration, Access, Search, Removal
10
Discovery and Join Protocols
l Used to find and join a group ofservices.
l Based on UDP multicast.l Services advertise capabilities.l Provide required software drivers.l Establish reference with lookup
service.l Unicast discovery also supported.
Discovery Protocol
UDP Multicast
LUSLUS
LUSLUS
LUSLUS
Network ServiceNetwork Service
11
Join Protocol
ServiceProxy
ServiceProxy
ServiceProxy
ServiceProxy
Network ServiceNetwork Service
LUSLUS
LUSLUS
Steps in Discovery and Join
l Jini™ enabled Object (representinga hardware and/or software service)multicasts a packet with a referenceto itself
l The service receives RMI referenceto Lookup service (one or more)
l The service joins a Federation byplacing an object representing itscapabilities into the Lookup servicefor other clients and services to use
12
Discovery and Join: Traditionalversus Jini™ Technology
TraditionalTechnology
l Device is addedto computer
l Device definition isedited in nodeconfiguration table
l Computer is restartedl Updated configuration
table is pushed tonetwork device map
Jini Technolgyl Device is plugged in
and powered upu Lookup service
receives multicastu Lookup service
authenticatessource
u Lookup servicesendsadvertisement
u Device joinsLookup service
Finding a Service
l To find a service, a Jini client locatesservice by querying a Lookup Serviceby type (Java Interface).
l Code moves from service to client viaLookup Service.
l Code needed to use service isdynamically loaded on demand.
13
Finding a Service
Service RequestServiceProxy
ServiceProxy
Network ClientNetwork Client
LUSLUS
Using a Service
l Communication is betweenservice and its proxy
l Independent of wire protocoll Protocol can change without
affecting clientl RMI semantics core to functionality
14
Using a Service
Any ProtocolNetwork ServiceNetwork ServiceService
ProxyServiceProxy
NetworkClientNetworkClient
Why Jini™ uses RMI
l RMI can pass entire Java objects andtheir code
l Works in any compliant JVMl Provides automatic serialization,
transport, and de-serialization ofobjects
l Robust and configurable securityoptions (RMI over SSL, AuthenticatedPrincipal, etc.)
15
The Details:Programming using Leases,
Events, and Transactions
Why Distributed Leasing?
l Problem: Partial failure in distributedsystems can lead to uncheckedresource consumption
l Traditional solution: systemadministrationuError-proneuCostlyuOnly happens when it’s too late
16
Distributed Leasing in Jini™
l Protocol for managing resources usinga renewable, duration-based model
l Contract between objectsl Resources can be shared or privatel Provides a method of managing
resources in an environment wherenetwork failures can, and do, occur
What are Leases?
l Time-based grants of resourcesor services
l Loose contracts between grantorand holder
l Negotiated for a set period of timel Can be shared or exclusive
17
Lease Operations
l Leases may be:uCancelled (explicit cleanup)uRenewed (explicit extension)uAllowed to expire (implicit cleanup)uObtained and manipulated by third parties
Distributed Leasing
l Resources are allocated only aslong as continued interest is shown
l Leasee is responsible to renew leasebefore expiry
l The network is self-healing
18
Distributed Events
l Extend Java™ event model to work ina distributed network
l Register interest, receive notificationl Allow for use of event managersl Support various delivery modelsuPush, pull, filter
l Use the Distributed Leasing protocol
Transaction model in Jini™
l Designed for distributed objectcoordination
l Light weight, object-orientedl Supports two-phase commitsl Uses Distributed Leasing protocoll Implemented in Transaction Manager
service
19
The Details:Jini Services
Services
l Represented by Java InterfacesuSeparation of “how” from “what”u Implement in hardware or softwareu Implementations can change over timeuMultiple implementations
l Set of services open endeduDevicesuSoftware servicesuBusiness objects
20
Services Enable Evolution
l Base interfaces can be extended to:uAdd new functionalityuCombine functionality
l Old clients can use base interfacel New clients can use extended
interfacel Allows evolution of implementation
without changing clients orinfrastructure
Services Are Definedby Java Interfaces
I’m a Printer
I’m a ColorPrinter, therefore a Printer too
InterfacePrinter
InterfacePrinter
InterfaceColorPrinter
InterfaceColorPrinter
21
Services Defined by Interfaces
I’m a PhotoCopier and a Printer
I’m a FaxMachine, a PhotoCopier,and a Printer
InterfacePrinter
InterfacePrinter
InterfacePhotocopier
InterfacePhotocopier
InterfaceFaxMachine
InterfacePhotocopier
InterfacePhotocopier
InterfacePrinter
InterfacePrinter
Client Finds Serviceby Interface
Give me a PhotoCopierNetworkClient
NetworkClient LUS
InterfacePhotocopier
InterfacePhotocopier
22
Client Finds Serviceby Interface
InterfacePrinter
InterfacePrinter
InterfaceColorPrinter
InterfaceColorPrinter
Give me a PhotoCopierLUSNetwork
ClientNetwork
Client
Client Finds Serviceby Interface
Give me a PhotoCopierLUS
InterfacePrinter
InterfacePrinter
NetworkClient
NetworkClient
23
Enabling Services
l Transaction manageruDefault service implementation.
l Jini 1.1 Utility ServicesuLookup Discovery service, manages
discovery on behalf of its clients.uLease Renewal service, receives and
stores remote event notifications onbehalf of its clients.
uEvent Mailbox service, manages leaserenewal activities on behalf of its clients.
Service Interfaces
l Community drivenuPrintinguService UI
l Don’t have to be done by Sunl Only base types need to be commonl Interfaces can evolveuNew apps can use new functionalitiesuOld apps still work
24
Legacy Services
l Jini requires Java at the networkuServices identified by Java typeuProxies may need code downloaded
l Implementation can be non-JavauWrap legacy language in JavauMake calls to legacy with JNI
Example Service Models
25
Proxy
Client
Java VM
Service Client
Dev 1 Dev 2 Dev 3JavaDeviceBay
RMI
PrivateProtocol
Example service model #1:Local device concentrator
Exposing a disk cluster as a single networked file store
ServiceProxy
Proxy
ClientJava Embedded Server
Service Client
Service Proxy
Dev 2 Dev 3
RMI
Dev 1
PrivateProtocol
Example service model #2:Remote device concentrator
Home network (AV equipment, appliances, etc.) communicate via Java Embedded Server™
26
Proxy
ClientJava VM
Service Client
Service Proxy
RMI
RMI, CORBA/IIOP,DCOM
Example service model #3: EJBservices
Accessing enterprise resources
EJB Server
HTTP, SHTTP Java VM
Enterprise resources
Detailed Example: Jini-Enabled Printer
Java VMJava VM
Jini InfrastructureJini Infrastructure
Drivers
GUIGUI
27
Discovery
l Multicast query for lookup service
UDP Multicast
LUS
Discovery
l Lookup service discovered
LUSLUS
28
Join
l Printer registers service objectwith LUS
LUSLUS
Locating Service
l Client asks LUS for Printer
LUSLUS
Printer?
29
Locating Service
l LUS returns printer serviceobject to client
LUSLUS
Using the Service
l Client communicates to printerthrough service object
LUSLUS
30
JavaSpaces™
What Is JavaSpaces?
l A Jini™ Servicel A Persistent Shared Object Storel Transactionally Securel Astonishingly Simplel Based on “tuple-spaces”
(see David Gelernter’s Linda system)
31
JavaSpaces Design
l Parallel programmingl Distributed systemsl Cooperating software ensembles
space
entries
JavaSpaces Benefits
l Anonymity between applicationsl Uncoupled communicationl Programs can communicate
through time or spacel Vast savings in design and
development time
32
JavaSpaces Concepts
l High-level communications betweenJava program
l SIMPLE: only a few operations to learnl EXPRESSIVE: a large number of
computing problems can be solved
JavaSpaces Programs
l Processes do not directly interactl Processes interact indirectly through
one or more spaces
33
What Is a Space?
l Persistent object storel Network accessiblel Sharedl Transactionally securel Can store executable content
Modification of Entries
l An Entry in a space cannotbe modified
l Must be taken, modified, written
process
process
process
modify
take
write
34
Matching Entries
l A template is used to match entriesin a space
l The template is simply an entry ofthe type to be matched
l Fields of the entry are used for matchingl Non-assigned fields are wildcards
Entries
l Entries are collections of typed objectsl Must implement net.jini.core.entry.Entryl Fields can be any serializable
Java™ objectl Fields must be public to be matchablel Entry needs no-arg constuctor
35
Example Entry
l This shows a minimal entry:
public class SpaceShip implements Entry {
public String name; public Integer score; public SpaceShip() {
}
}
Accessing a Space
l Jini is used to locate a spacel Sun’s implementation identifies
spaces by namel Convenience method from
JavaSpaces book:
SpaceAccessor.getSpace("name");
36
Space Operatons
l Very small number of operations aredefined on a space
l The three fundamental operations are:uWriteuReaduTake
Write Operation
l Writes an entry to a space
process write
37
Write Operation
l Instantiate an Entryl Set its fields as necessaryl Write the entry to the space
SpaceShip s = new SpaceShip();s.name = "USS Enterprise";
space.write(s, null, Lease.FOREVER);
Read Operation
l Reads an entry from a spacel Copy of object is returnedl Original remains in space
process read
38
Read Operation
l Build a templatel Read a matching entry from the space
SpaceShip template = new SpaceShip();template.name = "USS Enterprise";SpaceShip s = space.read(template, null, Long.MAX_VALUE);
Take Operation
l Takes an entry from a spacel Matched entry is removed from space
process take
39
Take Operation
l Build a templatel Take a matching entry from the space
SpaceShip template = new SpaceShip();template.name = "USS Enterprise";SpaceShip s = space.read(template, null, Long.MAX_VALUE);
Other Space Operations
l ReadIfExists()uNon-blocking read
l takeIfExists()uNon-blocking take
l Notify()uInform me when a matching entry
is written to the space
40
JavaSpaces Patterns
l Distributed Data StructuresuMultiple entries stored in one
or more spacesl ProtocolsuApplication-defined way to
manipulate/access data structures
Example: Distributed Array
l Each array element is an entryin a space
l Entry stores content and positionin array
l Protocol is defined to add/removearray elements
EndInteger position
ArrayElementInteger position Object content
41
Example: Distributed Array
l Multiple processes concurrentlyaccess the array through the space
processprocess
process
JavaSpaces Leases
l Based on Jini lease modell Resources allocated for fixed
time periodl Lease is specified when entries
are written to spacel When the lease expires, the space
removes the entry from its store
42
JavaSpaces Leases
l Lease time is parameter towrite operation
l Specified in milliseconds inSun’s implementation
l Lease object is returned by write()
Long duration = 1000*60*5; // 5 minutes
Lease 1 = space.write(ship, null, duration);
JavaSpaces Transactions
l JavaSpaces operations aretransactionally safe
l All operations are atomicl Multiple operations may be grouped
using a transaction objectl Based on Jini transaction modell Transactions may span multiple
spacesl Spec supports nested transactions
43
Example Application
l Image processingl Goal: perform operation on
every pixel in large imagel Problem: image ops are
computationally expensivel Solution: JavaSpaces
Example Application
l Perform edge detection on this image
44
Example Application
l Step 1: Divide image into titles
Example Application
l Step 2: Build Entry object for each tilel TileEntry contains code to
perform operation
Client Process
TileEntry
45
Example Application
l Step 3: Write tile entries to space
Client Process
Example Application
l Step 4: Server process concurrentlytakes tile entries from space (blockingif not available)
Server Process
take
46
Example Application
l Step 5: Server process executes code(contained in TileEntry) to processthe tile
Server Process
Example Application
l Step 6: When finished processing,server writes completed tile back tospace, after setting its FINISHED flag
Server Processwrite
47
Example Application
l Step 7: Concurrently, client takesFINISHED entries from space(blocking if not available) andreconstructs image
Client Process
take
Pure Scalability
l Want to process more images?l Just add more clients/server
Client Process
Client Process
Client Process
Server Process
ServerProcess
ServerProcess
ServerProcess
ServerProcess
48
Advantages
l Servers can be any platform thatsupports Java
l Can mix and match serversl Server needs no prior knowledge
of image operationl Highly scalablel Highly flexiblel Highly reliablel Simple design
JavaSpaces™ at JavaOne 1998
49
Jini™ Surrogate Architecture
Jini Surrogate Architecture
l Not every device supports a full Java™
2 Standard Edition (J2SE) virtualmachine.
l Even if a device does support Javatechnology (say through J2ME), it maynot have enough memory or meetother requirements to support a full Jiniimplementation.
l However, any networkable device canproxy via a surrogate that supportsJava and Jini technologies.
50
Jini Surrogate Architecture
l Allows almost any device to participatein Jini federations, including smallJ2ME devices or even non-Javadevices.
l Independent of device type.l Independent of network type.l Preserves Jini Plug and Work
functionality.l Developed as community project at
developer.jini.org/exchange/projects/surrogate/index.shtml
Jini Surrogate Architecture
JiniNetwork
Surrogate Capable Machine
DeviceDevice
Surrogate Host
Host ResourcesHost Resources
InterconnectAdaptor
InterconnectAdaptor
51
Related Technologies
Jini and EJB™
l JiniuDefines a set of protocols for dynamic
federations of servicesuDesigned for dynamic and distributed
environment
l EJBuDefines server-side component modeluDefines hosting environment of
componentsuDesigned for relatively "static" server-
centric environment
52
Jini and CORBA/DCOM
l JiniuJava™ technology centricuCode movement during runtimeuSubtype support
l CORBA/DCOMuCross-language supportuNo code movement
l IntegrationuCORBA/DCOM components can
be wrapped as Jini services
Jini and UPnP
l JiniuCode movement during runtimeuService-centric
l UPnPuNo code movementuDevice-centric
l IntegrationuUPnP devices can be wrapped
as Jini services
53
Jini and OSGi
l OSGiuDefines how smart consumer and small
business appliances can be connectedwith commercial Internet services
l Jini and OSGi are complementaryuJini can provide unified service
framework for OSGi network
Jini and Bluetooth
l BluetoothuOpen standard for wireless proximity
networking communicationuBased on low-cost short-range radio linkuAd-hoc connection among mobile devices
l Jini and BluetoothuFor IP-based Bluetooth devices, Jini
should work with no modificationsuFor non-IP-based Bluetooth devices,
proxy-based Jini services can be built
54
Jini and HAVi
l HAViuStands for Home Audio Video
InteroperabilityuNetwork interoperability of audio and
video devices from multiple vendorsn Transfer of digital contents between
HAVi devices
uJava technology based
l Jini and HAVi integrationuHAVi software modules can be
built as Jini services
Availability and Resources
55
Where are we today?
l 47,000 FCS downloadsl Average 2,000 downloads/monthl 29,000 SCSL Licenseesl 23 Commercial Licensesl Estimated 50,000 active Jini
developersl Four Jini Community meetings to datel 103 Jini Community projects
Jini Partners Include...
Adaptive NetworksAmerica OnlineAxis CommunicationsBEA SystemsBosch SiemensCisco Systems, Inc.Computer AssociatesCreative Design SolutionsDallas SemiconductorPhoenix TechnologiesSony CorporationPalm ComputingInprise Corporation
BullEchelonEncantoFunai Kinkos Corporation Kodak Metrowerks Motorola Novell Nokia Oki Electric Philips
QuantumSamsungSeagateSeikoEpsonCanonSharpSymbian3ComTatungToshibaXerox Corp.
56
Jini TechnologyStarter Kit v1.1
l No changes to the Core.l Focus of release is to add “helper”
utilities and services to aid developersin building Jini clients and services.
l JavaSpaces Technology rolledinto the extended platform (JXP) in thisrelease.
More Information
l Main Sun Jini pageuwww.sun.com/jini
l Jini Communityuwww.jini.org
l Mailing listsuarchives.java.sun.com/archives/jini-
users.htmluarchives.java.sun.com/archives/javaspac
es-users.html
57
More Information
l Jini™ Technology Webcastsu java.sun.com/jdc/onlineTraining/webcasts
l 3rd-party Jini websitesuwww.artima.com/jiniuwww.cdegroot.com/cgi-bin/jiniuwww.kedwards.com/jini/index.htmluwww.litefaden.com/sv/jd/
More Information
l Online tutorialsupandonia.canberra.edu.au/java/jini/tutorial
/Jini.xmluwww.oreilly.com/catalog/jininut/chapter/ch
04.htmluwww.eli.sdsu.edu/courses/spring99/cs696
/notes/index.html
58
Books
For more, please visit:www.sun.com/developers
© Copyright 2000 Sun Microsystems, Inc., All rights reserved.
Sun, Sun Microsystems, the Sun logo, Solaris Operating Environment, Java, Jini, JavaOS,PersonalJava, JavaPhone, JavaTV, EmbeddedJava, Java Card, JDBC, the Java Coffee Cuplogo, JDK, Java virtual machine, JavaCheck, JavaScript, Java Filter, JavaBeans, Java Blend,JavaOS for Consumers, JavaOS for Business, Java Embedded Server, Java DynamicManagement Kit, JavaEngine, 100% Pure Java, HotJava Views, HotJava and The Network IsThe Computer are trademarks, registered trademarks, or service marks of Sun Microsystems,Inc. in the United States and other countries.
All SPARC trademarks are used under license and are trademarks or registered trademarks ofSPARC International, Inc. in the United States and other countries. Products bearing SPARCtrademarks are based upon an architecture developed by Sun Microsystems, Inc.
UNIX is a registered trademark in the United States and other countries, exclusively licensedthrough X/Open Company, Ltd.
59