`
`The Jini™ Specification
`
`1
`
`APPLE 1009
`
`APPLE 1009
`
`1
`
`
`
`The Jini” Technology Series
`Lisa Friendly, Series Editor
`Ken Arnold, Technical Editor
`For more information see: http://java.sun.com/docs/books/jini/
`
`This series, written by those who design, implement, and document the Jini™ technology,
`shows how to use, deploy, and create Jini applications. Jini technology aimsto erase the
`hardware/software distinction, to foster spontaneous networking among devices, and to
`make pervasive a service-basedarchitecture. In doing so, the Jini architecture is radically
`changing the way we think about computing. Books in The Jini Technology Series are
`aimed at serious developers looking for accurate, insightful, thorough, and practical
`material on Jini technology.
`
`The Jini Technology Series web site contains detailed information on the Series,
`including existing and upcomingtitles, updates, errata, sources, sample code, and
`other Series-related resources.
`
`
`
`Ken Arnold, Bryan O’ Sullivan, Robert W. Scheifler, Jim Waldo, Ann Wollrath, The Jini™ Specification
`ISBN 0-201-61634-3
`
`Eric Freeman, Susanne Hupfer, and Ken Arnold, JavaSpaces™ Principles, Patterns, and Practice
`ISBN 0-201-30955-6
`
`
`
`2
`
`
`
`The Jini™ Specification
`
`tion
`
`|
`
`|
`
`Ken Arnold
`Bryan O’ Sullivan
`Robert W. Scheifler
`Jim Waldo
`Ann Wollrath
`
`a
`vv
`
`ADDISON-WESLEY
`An imprint of Addison Wesley Longman,Inc.
`Reading, Massachusetts * Harlow, England « Menlo Park, California
`Berkeley, California * Don Mills, Ontario * Sydney
`Bonn * Amsterdam * Tokyo * Mexico City
`
`
`
`3
`
`
`
`This book is dedicated to the Jini team
`
`without whom this book
`would not have been necessary
`
`
`
`4
`
`
`
`
`
`
`
`Contents
`
`FOreword ..... 0... co.cc ccc cece cece cence cueueeeueaeueuenenes xvii
`
`Preface ...0. 0. occ ccc ccc cece cece cece en eeeeueeetueeeseseeees xix
`
`
`
`
`
`PART I Overview and Examples
`
`The Jini Architecture: An Introduction .................. 3
`1
`OVErVieW 2.0.0.0 cnet tere enna eenes 3
`1.1
`Goals ... 0. cece eee teen tee ene nee 4
`1.2
`Architecture 2.00... ee eee 5
`1.3
`Whatthe Jini Architecture Depends Upon ..............--- 7
`1.4
`The Value of a Proxy ..... bcc eeceueeueueveettunertntees 7
`1.5
`The Lookup Service 2.2... cc cece eee eee eens 9
`1.5.1
`Attributes 2.0.0.0... ee eee 10
`1.5.2
`Membership Management ............--.-+++- 11
`1.5.3
`Lookup Groups ..........02. 02 2c eee eee eens 12
`1.5.4
`Lookup Service Compared to Naming/Directory
`ServiceS 2.0... ccc eee eee 13
`Conclusion .... 0.00.0 00sec eee cence eee eee e eee 14.
`Notes on the Example Code ............... Lecce eee eee 16
`1.7.1
`Package Structure ... 2.6.6 ee ees 16
`Writing a Client ................ 0.2.0 ee eee e eee cee 19
`2.1
`The MessageStream Interface ........... 000. c eee ee eee 19
`2.2
`The Client 2.0... ccc ee eee eee eee 20
`2.3
`In Conclusion 2.2.0... cee eee ee eens 27
`
`1.6
`1.7
`
`2
`
`vil
`
`
`
`5
`
`
`
`viii
`
`3
`
`4
`
`3.2
`
`Writing a Service .... 2.0.0.6... cece cece eee eens 29
`3.1
`Good Lookup Citizenship ........... 00.00 e cece eee eee 29
`3.1.1
`The JoinManager Utility .................54. 30
`The FortuneStream Service ......... 00000 cece eee 30
`3.2.1
`The Implementation Design .............-.-55 32
`3.2.2
`Creating the Service... 2.6... ee eee 32
`3.2.3
`The Running Service . 2.2... cece cee ee 34
`The ChatStream Service ......0 2... cc eee cee eee 37
`3.3.1
`“Service” versus “Server” ......... 00252-2005: 4]
`3.3.2
`Creating the Service ......... 0.0. . 05s eee eee Al
`3.3.3
`The Chat Server ..... 0.0.0... 2020000 e eeu 43
`3.3.4
`Implementing nextInLine ..............00005 50
`3.3.5
`Notes on Improving ChatServerImp] .......... 5]
`3.3.6
`The Clients 2.0.0.0... ccc eee eee eee 52
`The Rest of This Book .......................0020-00 000 57
`
`3.3
`
`
`
`The Jini Specification
`PART 2
`
`
`AR The Jini Architecture Specification ..................... 61
`AR.1 Introduction ..........0....0.00 6020 cece cece eee eee 61
`AR.1.1 Goals of the System 2.2.20... 0.022 eee 61
`AR.1.2 Environmental Assumptions ........ 0.00000 0c eevee eee 63
`AR.2 System Overview .......0...0. 000 c eee cee een ees 65
`AR.2.1 Key Concepts 2.0.0... 0.00. ccc eee teens 65
`AR.2.1.1 Services 2.0.0.0... 00 cece cece ee eee 65
`AR.2.1.2 Lookup Service 1.0.2.2... ce cece eee 66
`AR.2.1.3.
`Java Remote Method Invocation (RMI) ......... 66
`AR.2.1.4 Security 2.0.2... ccc tenets 67
`AR.2.1.5 Leasing ...... 0c eee eee eee 67
`AR.2.1.6 Transactions ..........0. 005 ce eee eee 67
`AR.2.1.7 EventS 20.00.00. cece eee eee 67
`AR.2.2 Component Overview 00.0... 0600s eee eee ee eee ees 68
`AR.2.2.1 Infrastructure 2.0... 02.0 cece eee 69
`AR.2.2.2 Programming Model ...... 0.6.00. e ee eee eee 69
`AR.2.2.3 Servic€S 0.0... cee eee ene 71
`AR.2.3. Service Architecture 2.0.0... eee 72
`AR.2.3.1 Discovery and Lookup Protocols .............. 72
`AR.2.3.2 Service Implementation .................4+45- 75
`AR.3 An Example ...........0 0000 c ccc cece eee een eee 77
`AR.3.1 Registering the Printer Service .............0-.00 50s e eee 77
`AR.3.1.1 Discovering the Lookup Service .............-- 77
`
`
`
`6
`
`
`
`
`
`ix
`
`AR.3.1.2 Joining the Lookup Service ...............-2... 77
`AR.3,1.3. Optional Configuration. ............0...0..0.. 78
`AR.3.1.4 Staying Alive . 0.0.2.2 eee 78
`AR.3.2 Printing 2.0... ec cece teens 78
`AR.3.2.1 Locate the Lookup Service .................00. 78
`AR.3.2.2 Search for Printing Services .................0 79
`AR.3.2.3 Configuring the Printer...............2...000. 79
`AR.3.2.4 Requesting That the Image Be Printed........... 79
`AR.3.2.5 Registering for Notification ................... 80
`AR.3.2,6 Receiving Notification ....................00. 80
`AR4 For More Information .........................0....005. 81
`
`DJ The Jini Discovery and Join Specification ............. 83
`DJ.1 Introduction ...0..0.000 000 ccc cece ec ees 83
`DJ.1.1 Terminology 2.2.0.0... 0.0. c ccc cee cnet e enn eeaes 83
`DJ.1.2 Host Requirements ........0.. 0.0.0 c cece cence ees 84
`DJ.1.2.1 Protocol Stack Requirements for IP Networks ..... 84
`Protocol Overview ........0.. 00 0c cece cence een 85
`DJ.1.3
`DJ.1.4 Discovery in Brief 2.2... ccc cence ee 85
`DJ.14.1 Groups ...... cece cece cece eee 85
`DJ.1.4.2 The Multicast Request Protocol ................ 86
`DJ.1.4.3. The Multicast Announcement Protocol .......... 87
`DJ.1.4.4 The Unicast Discovery Protocol................ 88
`DJ.1.5 Dependencies .. 0.0... 00002 cece eee nes 88
`DJ.2 The Discovery Protocols ................. 00.0.0. c ceca eee 89
`DJ.2.1
`Protocol Roles... 22... cee ees 89
`DJ.2.2. The Multicast Request Protocol ................ 00. eae 89
`DJ.2.2.1
` Protoco] Participants .. 0.0.0.0... 0c: cece eee eee 89
`DJ.2.2.2. The Multicast Request Service ................. 90
`DJ.2.2.3. Request Packet Format ..............20000000. 91
`DJ.2.2.4 The Multicast Response Service ............... 93
`DJ.2.3. Discovery Using the Multicast Request Protocol ........... 93
`DJ.2.3.1
`Steps Taken by the Discovering Entity .......... 93
`DJ.2.3.2 Steps Taken by the Multicast Request Server ..... 94
`DJ.2.3.3 Handling Responses from Multiple Djinns ....... 95
`DJ.2.4 The Multicast Announcement Protocol ................... 95
`DJ.2.4.1_ The Multicast Announcement Service ........... 95
`DJ.2.4.2 The Protocol ...... 0.0... ccc cece eee ees 97
`DJ.2.5 Unicast Discovery .. 0.0.0... e eee eee 97
`DJ.2.5.1 The Protocol .........0.0.0000 200 e eee 98
`DJ.2.5.2 Request Format... 2.0.0... eee ees 99
`DJ.2.5.3. Response Format ............-00 eee eueceee 100
`
`
`
`7
`
`
`
`
`
`DJ.3 The Join Protocol ............... 00.0.0. cece eee 101
`DJ.3.1
`Persistent State... 0. eer eee eens 101
`DJ.3.2 The Join Protocol .......... 0... ccc cee eens 101
`
`Initial Discovery and Registration ............. 102
`DJ.3.2.1
`DJ.3.2.2 Lease Renewal and Handling of Communication
`Problems .... 0.2... sees cece eee eee eee 102
`
`DJ.3.2.3. Making Changes and Performing Updates ...... 103
`DJ.3.2.4
`Joming or Leaving a Group ...............04. 103
`DJ.4 Network Issues ..........00.00 0000 e cee eee 105
`DJ.4.1_
`Properties of the Underlying Transport ................. 105
`DJ.4.1.1 Limitations on Packet Sizes ........... 0000065 105
`
`DJ.4.2 Bridging Calls to the Discovery Request Service .......... 105
`DJ.4.3 Limiting the Scope of Multicasts ....................-. 106
`DJ.4.4 Using Multicast IP as the Underlying Transport .......... 106
`DJ.4.5 Address and Port Mappings for TCP and Multicast UDP ... 106
`DJ.5 LookupLocator Class ..............00.000.0.0000 00000 c cae 107
`DJ.5.1
`Jini Technology URL Syntax .........0....00...00004. 108
`DJ.5.2 Serialized Form... 0... ccc eee eens 109
`
`EN The
`
`EN..
`
`EU Thi
`
`EU,
`
`LE Th
`
`LE
`
`DU The Jini Discovery Utilities Specification ............. 111
`DU.1 Introduction ............... 0... cece cece ee eens 111
`DU.1.1 Dependencies ........0 00000.cec eee eee 111
`DU.2 Multicast Discovery Utility ............................ 113
`DU.2.1 The LookupDiscovery Class ...... 0.0.0.0... 0c cee eee 114
`DU.2.2 Useful Constants ....... 0.0: e cece eee eee ees 115
`
`LI
`
`DU.2.3 Changing the Set of Groups to Discover ................ 115
`DU.2.4 The DiscoveryEvent Class ....... 0. ccc cece eee eens 116
`DU.2.5 The DiscoveryListener Interface .................... 116
`DU.2.6 Security and Multicast Discovery ...............-.20-5 117
`DU.2.7 Serialized Forms .........0..0..002. 02. c eee eee eee 118
`
`DU.3 Protocol Utilities ...............00....0. 0.0.20. e eee eee 119
`DU.3.1 Marshalling Multicast Requests ............00..20200.. 119
`DU.3.2 Unmarshalling Multicast Requests ...................-. 120
`DU.3.3 Marshalling Multicast Announcements ................. 12]
`DU.3.4 Unmarshalling Multicast Announcements ............... 122
`DU.3.5 Easy Access to Constants 0.2.0.2... 0. 0c cece eee ee 122
`DU.3.6 Marshalling Unicast Discovery Requests ................ 123
`DU.3.7 Unmarshalling Unicast Discovery Requests.............. 123
`DU.3.8 Marshalling Unicast Discovery Responses ............... 124
`DU.3.9 Unmarshalling Unicast Discovery Responses ............ 124
`
`EV TI
`
`EE
`
`
`
`8
`
`
`
`EN The Jini Entry Specification ............................ 127
`EN.1 Entries and Templates .................000.000000. 005. 127
`EN.1.1 Operations 0.00222e eens 127
`EN.1.2 Entry... 0.0.0 ccc eect ccc eeuenvave 128
`EN.1.3 Serializing Entry Objects ...........5..0.0.. 0.000. e eeu 128
`EN.1.4 UnusableEntryException ............00....00000 00 129
`EN.1.5 Templates and Matching ................00..cceeeeeee 131
`EN.1.6 Serialized Form ....... 0.00000... c ccc e eee e ec eeeee 131
`
`EU The Jini Entry Utilities Specification .................. 133
`EU.1 Entry Utilities 0000000000 eee cee 133
`BU.1.1 AbstractEntry ....... 20.0... ccc cece eee eee eeeees 133
`EU.1.2 Serialized Form ...... 0... ccc ec cece we eeveneees 134
`
`LE The Jini Distributed Leasing Specification ........... 137
`LE.1 Introduction ..........00000000000 00 coe ce ccc. 137
`LE.1.1 Leasing and Distributed Systems
`.............-.-...000, 137
`LE.1.2 Goals and Requirements .........0....00 cece eceeeeeee 140
`LE.1.3° Dependencies ... 2.0.0.2... ccc ccc eee eee eee eee eee 140
`LE.2 Basic Leasing Interfaces ..................00...00...0. 141
`LE.2,.1 Characteristics of aLease ........00 0.0000 cece eee 141
`LE.2.2 Basic Operations .... 2.2...ec eens 142
`LE.2.3 Leasing and Time ............. 0000s cece ce cece eseeee 147
`LE.2.4 Serialized Forms .......... 0000s cee c cece cece eeeeee 148
`LE.3 Example Supporting Classes .......................... 149
`LE.3.1 A Renewal Class ........0 00000 cece eccececeeccveeus 149
`LE.3.2 A Renewal Service 2.0.0.0... 0000. c cece cece ee euuues 151
`
`EV TheJini Distributed Event Specification .............. 155
`EV.1 Introduction ...........0.0..000 0000 c eve cece cee eee 155
`EV.1.1 Distributed Events and Notifications .................... 155
`EV.1.2. Goals and Requirements .........0.0.00.. 00000 cc cee eaes 156
`EV.1.3 Dependencies ...... 0.00... cece eee eee 157
`EV.2 The Basic Interfaces ...........0..000.000 0.000.000.0002. 159
`EV.2.1 Entities Involved ....... 0... c teen cece eee eeeees 159
`EV.2.2 Overview of the Interfaces and Classes .................. 161
`EV.2.3 Details of the Interfaces and Classes ...............000-. 163
`EV.2.3.1 The RemoteEventListener Interface.......... 163
`EV.2.3.2 The RemoteEvent Class...............0.005. 164
`EBV.2.3.3. The UnknownEventException ............... 165
`EV.2.3.4 An Example EventGenerator Interface ........ 166
`EV.2.3.5 The EventRegistration Class .............. 168
`
`
`
`9
`
`
`
`_
`
`LU.2
`
`LS The
`LS.1
`
`LS.2.
`
`LS.3
`
`LS.
`
`js Tt
`.
`JS
`
`EV.2.4 Sequence Numbers, Leasing and Transactions ...........-. 169
`EV.2.5 Serialized Forms .... 2.2... cc cee eee eee eens 170
`EV.3 Third-Party Objects .............--.- 0. - eee e eee ee eens 171
`EV.3.1 Store-and-Forward Agents ........ 6.6600 eee eee ees
`171
`EV.3.2 Notification Filters ...... 2.2.06 e dee eee 173
`EV.3.2.1 Notification Multiplexing ..........+---++055 174
`EV.3.2.2 Notification Demultiplexing ..............+-- 174
`EV.3.3 Notification Mailboxes 2.0.2... .0 200s eee eee eens 175
`EV.3.4 Compositionality 0.0.0.0... 666 e eee ee eee eee eee 176
`EV.4 Integration with JavaBeans Components .............. 179
`EV.4.1 Differences with the JavaBeans Component Event Model
`.. 180
`EV.4.2 Converting Distributed Events to JavaBeans Events ....... 182
`
`‘XxX The Jini Transaction Specification .................... 185
`TX.1 Introduction ..............00. 006. e cece eee eee ees 185
`TX.1.1 Model and Terms ............ cece cece ee eee eens 186
`TX.1.2 Distributed Transactions and ACID Properties .......-.-.
`188
`TX.1.3 Requirements 11.20... 60... e cece eee eee eee eee ees 189
`TX.1.4 Dependencies ..........00 22 cece eee eens 190
`TX.2 The Two-Phase Commit Protocol ...............-+---- 191
`TX.2.1 Starting a Transaction ........-- eee eee eee eee ees 192
`TX.2.2 Starting a Nested Transaction .......-...-202 00s e seers 193
`TX.2.3 Joining a Transaction ..... 6.222. eee eee eee 195
`TX.2.4 Tramsaction States ....... 060 e ee eee eee eee te ete 196
`TX.2.5 Completing a Transaction: The Client’s View .........--. 197
`TX.2.6 Completing a Transaction: A Participant’s View .......... 199
`TX.2.7 Completing a Transaction: The Manager’s View ........-. 202
`TX.2.8 Crash Recovery ....... 2000.0 cece eee eee ee eens 204
`TX.2.8.1 The Roll Decision ........--. 60. cece ee eee 205
`TX.2.9 Durability .........055 50 eee eet eens 205
`TX.3 Default Transaction Semantics ..............-.-.---+:. 207
`TX.3.1 Transaction and NestableTransaction Interfaces...... 207
`TX.3.2 TransactionFactory Class .......-..0.4 see eee eens 209
`TX.3.3. ServerTransaction and NestableServerTransaction
`ClasSeS 2. cee ee eee nee 210
`TX,3.4 CannotNestException Class ........-6 +202 reece renee 212
`TX.3.5 Semantics 2.00.0. ccc cee eee ene ene 212
`TX.3.6 Serialized Forms ......... 0.00 cece eens 214
`
`LU The Jini Lookup Service Specification ................ 217
`LU.1 Introduction .............0.0 000 c eect ee ene 217
`LU.1.1 The Lookup Service Model... 1.66.46 e eee eee eee ee 217
`LU.1.2 Attributes
`. 0.000. ete ee 218
`
`
`
`10
`
`
`
`|
`
`
`
`xiii
`
`LU.2
`
`LU.1.3 Dependencies ....... 00.e teen eae 219
`The ServiceRegistrar ...................0.000 0c eee ee 221
`LU.2.1 ServiceID ....... 0.000000ee 221
`LU.2.2 ServiceItem .......... 0. cc eee ee eee 222
`LU.2.3 ServiceTemplate and Item Matching .................. 223
`LU.2.4 Other Supporting Types .......0 2.0... eee eee eee 224
`LU.2.5 ServiceRegistrar.... 0... eee ee es 225
`LU.2.6 ServiceRegistration ........ 02ers 229
`LU.2.7 Serialized Forms .........0.. 0002 e eee cee eee e ees 230
`
`LS The Jini Lookup Attribute SchemaSpecification .... 233
`LS.1 Introduction. ............... 0.00. c cece cece eee ee 233
`LS.1.1 Terminology ........ 0... cee eee ce ee ee eee ee 234
`LS.1.2 Design Issues ..... 0.2.0... 2c eee ee eee 234
`LS.1.3 Dependencies ...... 2... eee eee 235
`LS.2. HumanAccessto Attributes ......................005. 237
`LS.2.1 Providing a Single View of an Attribute’s Value .......... 237
`LS.3 JavaBeans Components and Design Patterns ......... 239
`LS.3.1 Allowing Display and Modification of Attributes .......... 239
`LS.3.1.1 Using JavaBeans Components with Entry Classes
`239
`LS.3.2 Associating JavaBeans Components with Entry Classes
`.... 240
`LS.3.3 Supporting Interfaces and Classes ..............--..--5- 241
`LS.4 Generic Attribute Classes ...........0..0..0.0... 00.005. 243
`LS.4.1
`Indicating User Modifiability ...................00045. 243
`LS.4.2. Basic Service Information ................ 0.00000 e eee 243
`LS.4.3. More Specific Information ........ 00... e eee ee eee 245
`LS.4.4 Naming a Service ...... 0... ee cee eee eee 246
`LS.4.5 Adding a Comment to a Service ...........02.. 2220000. 246
`LS.4.6 Physical Location ...... 0.0... eee eee cee eee eee 247
`LS.4.7 Status Information .......... 0... cece eee cee eee eee 248
`LS.4.8 Serialized Forms ...... 0... cee eee ee ete teens 249
`
`
`
`JS The JavaSpaces Specification ........................... 253
`JS.1
`Introduction. ..............0.0..006. 02000 c eee eee eee 253
`JS.1.1
`The JavaSpaces Application Model and Terms .........:. 253
`JS.1.1.1 Distributed Persistence ...............-...00. 254
`JS.1.1.2 Distributed Algorithms as Flows of Objects ..... 254
`JS.1.2 Bemefits 2.0... cece eee cece eee eee eens 256
`JS.1.3
`JavaSpaces Technology and Databases .................. 257
`JS.1.4
`JavaSpaces System Design and Linda Systems ........... 258
`JS.1.5 Goals and Requirements ....... 0... cece ee erence eens 259
`JS.1.6 Dependencies ...... 0.00...cccc eee eee eens 260
`
`
`
`11
`
`
`
`
`
`
`XIV
`
`JS.2 Operations ........000.00 0000e cee, 261
`VS.2.10Entries 200.0. e cence ese eeecevneee 261
`JS.2.2
`net.jini.space.JavaSpace ..... 00... cece cece eeee 262
`JS.2.2.1
`InternalSpaceException ................. 263
`JS.2.30 Write ooo cc cece eee e cent eeeevaes 264
`JS.2.4
`readIfExists andread 2.2.0... ccc ccc cece eee ees 264
`JS.2.5
` takeIfExists and take 2.00.0... cece ccc eeveuees 205
`JS.2.6
`smapshot .........0 000. c cece ccc cee cee eeeeunns 265
`JS.2.7 motify oo. cece ete ete eevenyey 266
`JS.2.8 Operation Ordering ........00.0 00000 ccc cee eee ee eee 268
`JS.2.9
`Serialized Form... 00... ccc cece cece eect eee eee 268
`JS.3 Transactions. .........0000 0000. ece cece veces 269
`JS.3.1 Operations under Transactions ...........00..-ceec eee 269
`JS.3.2 Transactions and ACID Properties .........000..0000-0, 270
`JS.4 Further Reading ..........0.0.000000 00000 273
`JS.4.1
`Linda Systems 2.0.0... ccc cece cc eee 273
`JS.4.2 The Java Platform ........ 0.00000 ccc eee cece eeuee 273
`JS.4.3° Distributed Computing ..........2...... 00000 cece eee 274
`
`DA The Jini Device Architecture Specification ........... 277
`DA.1 Introduction ..............00000.00 000 cece ventas 277
`DA.1.1 Requirements from the Jini Lookup Service ............. 278
`DA.2 Basic Device Architecture Examples................... 281
`DA.2.1 Devices with Resident Java Virtual Machines ............ 28]
`DA.2.2 Devices Using Specialized Virtual Machines............. 283
`DA.2.3 Clustering Devices with a Shared Virtual Machine
`(Physical Option) ........0. 00000 ec ec eee eee ee ee 284
`DA.2.4 Clustering Devices with a Shared Virtual Machine
`(Network Option)
`......0.00000 000002 cee cece eee eee 286
`DA.2.5 Jini Software Services over the Internet Inter-Operability
`Protocol occ eee eee eee c cern ees 288
`
`
`
`
`
`PART 3 Supplemental Material
`
`The Jini Technology Glossary .............................. 293
`
`Appendix A: A Note on Distributed Computing ......... 307
`A.l
`Introduction ..... 00000... 0 occ cece cece cece 307
`A.l.1
`Terminology 20.2.0... 2.000. c ccc cece eseucceeevevs 308
`
`
`
`12
`
`
`
`
`
`XV
`
`a
`
`a]
`cE
`af
`f
`
`|
`
`TheVision of Unified Objects ......................... 308
`A.2
`A. Déja Vu All Over Again ..............-.-.-0.-0 2c eee 311
`A.4
`Local and Distributed Computing .................... 312
`AAL
`Latency 00... ccc cece cee eee eee e eens 312
`A.4.2 Memory Access ........ 000 eee eens 314
`Partial Failure and Concurrency ..................... 316
`A.5_
`The Myth of “Quality of Service” ..................... 318
`A.6
`Lessons From NFS ................0000 0020s e eee ees 320
`A.7
`Taking the Difference Seriously ...................-.-- 322
`A.8
`A Middle Ground ..................2.0 00200 ce cee cece es 324
`A.9
`A.10 References ...........00 000 e cece ene eee 325
`A.11 Observations for this Reprinting ...................... 326
`
`Appendix B: The Example Code .........................-. 327
`
`Index o.oo cece teen tent eee e eee e nee 371
`
`Colophon ...........0..0 0.000 c ccc e cece t een eee 385
`
`
`
`13
`
`
`
`_ mesma en SE ESigRGSSeSi SENSESST
`
`
`
`Foreword
`
`Tis emergenceof the Internet has led computing into a new era.It is no longer
`what your computer can do that matters. Instead, your computer can have access
`to the power of everything that is connected to the network: The Network is the
`Computer™. This network of devices and services is the computing environment
`of the future.
`The Java™ programming language brought reliable object-oriented programs
`to the net. The power ofthe Java platform is its simplicity, which allows program-
`mersto be fully fluent in the language. This simplicity allows debugged Java pro-
`gramsto be written in about a quarter the timeit takes to write programs in C++.
`We believe that use of the Java platform is the key to the emergence of a “best
`practices” discipline in software construction to give usthe reliability we need in
`our software systems as they become more and more widely used.
`The Jini™ architecture is designed to bring reliability and simplicity to the
`construction of networked devices and services. The philosophy behind Jini is lan-
`guage-based systems: a Jini system is a collection ofinteracting Java programs,
`and you can understand the behavior of this Jini system completely by under-
`standing the semantics of the Java programming language and the nature of the
`network, namely that networks have limited bandwidth, inherentlatency, and par-
`tial failure.
`Becausethe Jini architecture focuses on a few simple principles, we can teach
`Java language programmersthe full power of the Jini technologyin a few days. ‘To
`do this, we introduce remote objects (they just throw a RemoteException), leas-
`ing (commitments in a Jini system are of limited duration), distributed events (in
`the network events aren’t as predictable on a single machine), and the need for
`two-phase commit (because the network is a world of partial failures). This small
`set of additional concepts allows distributed applications to be written, and we can
`illustrate this with the JavaSpaces™ service, whichis also specified here.
`For me,the Jini architecture represents the results of almost 20 years of yearn-
`ing for a new substrate for distributed computing. Ever since I shipped thefirst
`
`xvii
`
`
`
`14
`
`14
`
`
`
`
`
`FOREWORD
`
`widely used implementation of TCP/IP with the Berkeley UNIX system, I have
`wanted to raise the level of discourse on the network from the bits and bytes of
`TCP/IP to the level of objects. Objects have the enormous advantage of combining
`the data with the code, greatly improving thereliability and integrity of systems.
`For me, the Jini architecture represents the culmination ofthis dream.
`I would like to thank the entire Jini team for their continuing hard work and
`commitment.
`I would especially like to thank my longtime collaborator Mike
`Clary for helping to get the Jini project started and for directing the project; the
`Jini architects Jim Waldo, Ken Arnold, Bob Scheiffler, and Ann Wollrath for
`designing and implementing such a simple and elegant system; Mark Hodapp for
`his excellent engineering management; and Samir Mitra for committing early to
`the Jini project, helping us understand how to explain it and what problemsit
`wouldsolve, and for driving the key business developmentthat helped give Jini
`technology the momentum it has in the marketplace today. I would also like to
`thank Mark Tolliver, the head of the Consumer and Embedded Division, which
`the Jini project becamepart of, for his support.
`Finally, I would like to thank Scott McNealy, with me a founder of Sun
`Microsystems™, Inc., and its longtime CEO.It is his continuing support for
`breakthrough technologies such as Java and Jini that makes them possible. As
`Machiavelli noted, it is hard to introduce new ideas, and support like Scott’s is
`essential to our continuing success.
`
`BILL Joy
`ASPEN, COLORADO
`APRIL, 1999
`
`Tue Jini
`Networks a
`existing thi
`are therefor
`tiple proces
`These
`changes ap
`A distribut
`change. Tk
`This b
`
`architectur
`following :
`first sectio
`cal manag
`The s¢
`you withit
`of them a:
`tem. As w
`can start 5
`The s
`specificat
`ture.
`The t
`
`defines te
`design, al
`
`
`
`15
`
`
`
`
`
`
`Preface
`
`Perfection is reached, not whenthere is no longer anything to add,
`but when there is no longer anything to take away.
`—Antoine de Saint-Exupery
`
`Tie Jini architecture is designed for deploying and using services in a network.
`Networks are by nature dynamic: new things are added, old things are removed,
`existing things are changed, and parts of the network fail and are repaired. There
`are therefore problems unlike any that will appear in a single process or even mul-
`tiple processes in a single machine.
`These differences require an approach that takes them into account, makes
`changes apparent, and allows older parts to work with newerparts that are added.
`A distributed system must adapt as the network changes since the network will
`change. The Jini architecture is designed to be adaptable.
`This book contains three parts. The first part gives an overview of the Jini
`architecture, its design philosophy, and its application. This overview sets up the
`following sections, which contain examples of programmingin a Jini system. The
`first section of the introduction is also usable as a high-level overview for techni-
`cal managers.
`The sections of the introduction that contain examples are designed to orient
`you within the Jini technology and architecture. They are nota full tutorial: Think
`of them as a tour through the process of design and implementation in a Jini sys-
`tem. As with any tour, you can get the flavor of how things work and where you
`can start your owninvestigation.
`The second part of the book is the specification itself. Each chapter of the
`specification has a brief introduction describing its place in the overall architec-
`ture.
`
`The third part of the book contains supplementary material: a glossary that
`defines terms used in the specifications and in talking about Jim architecture,
`design, and technology, and two appendices. Appendix A is a reprint of “A Note
`
`xix
`
`
`
`16
`
`16
`
`
`
`PREFACE
`
`on Distributed Computing,” which describescritical differences between local and
`remote programming. Appendix B contains the full source code for the examples
`in the introductory material.
`
`HISTORY
`
`The Jini architecture is the result of a rather extraordinary string of events. But
`then almost everything is. The capriciousness of life—and to the fortunate, its
`occasional serendipity—is always extraordinary. It is only in retrospect that we
`examine the causes and antecedents of something interesting and decide that,
`because they shaped that interesting result, we will call them “extraordinary.”
`Other events, however remarkable, go unremarked because they are unexamined.
`Those of us who wrote the Jini architecture, along with the many whocontributed
`to its growth, are lucky to have a reason to examineourparticular history to notice
`its pleasures.
`This is not the proper place for a long history of the project, but it seems
`appropriate to give a brief summary of the highlights. The project had its origins
`in Sun Microsystems Laboratories, where Jim Waldo ran the Large Scale Distri-
`bution research project. Jim Waldo and Ken Arnold had previously been involved
`with the Object Management Group’s first CORBA specification while working
`for Hewlett-Packard. Jim broughtthat experience and a long-term backgroundin
`distributed computing with him to Sun Labs.
`Soon after joining the Labs, Jim made Ann Wollrath part of the team. Soon
`after, observations about many common approachesin the field of distributed
`computing led Jim, Ann, and the other authors to write “A Note on Distributed
`Computing,” which outlined core distinctions between local and distributed
`design. Many people had beentrying to hide those differences under the general
`tubric of “local/remote transparency.” The “Note” arguedthat this was not possi-
`ble. It has become the most cited Sun Laboratories technical report, and the les-
`sonsit distills are at the core of the design approach taken by the project.
`At this time the project was using Modula 3 Network Objects for experiments
`in distributed computing. As Modula 3 ceased to be developed, the team looked
`aroundfor a replacementlanguage.At that time Oak, the language an internal Sun
`project, seemed a viable replacement with some interesting new properties. To a
`research project, the fact that Oak was commercially insignificant wasirrelevant.
`It wasat this time that Ken rejoined Jim on his new team.
`Soon after, Oak was renamed “Java.”
`Whenit wasstill Oak, it once had a remote method invocation mechanism,
`but that was removed when the mechanism failed—it, too, had fallen into the
`local/remote transparency trap. When Bill Joy and James Gosling wanted to cre-
`ate a working distributed computing mechanism,they asked Jim to leadthe effort,
`
`PREFACE
`
`which swi
`Asthefirs
`an exploré
`uted com]
`tral appro
`After
`its horizoa
`name “Jit
`a separat
`was soon
`
`rience fre
`architect
`Astk
`
`the archi
`lookup d
`time to g
`and run
`Brian M
`tecture ¢
`
`impleme
`Adrian ¢
`Charlie :
`nies, sta
`team to
`
`duction
`to worki
`over the
`structuri
`Our
`
`dan Dal
`Emily §
`Roman
`Hurley
`Marksj
`ness d
`McNer
`Vasque
`the Jini
`
`Jini
`It is
`
`
`
`17
`
`17
`
`
`
`PREFACE
`
`Xxi
`
`which switched our team from the laboratories into the JavaSoft product group.
`Asthefirst result of this effort, Ann, as the Java RMI architect, steered the team on
`an exploration of what could be done with a language-centric approach todistrib-
`uted computing (most distributed computing systemsare built on language-neu-
`tral approaches).
`After RMI becamepart of the Java platform, Bill Joy asked the team to expand
`its horizons to include a platform for easier distributed computing, coining the
`name “Jini.”! He convinced Sun managementto put the RMI and Jini project into
`a separate unit. This new unit started with Jim, Ann, Ken, and Peter Jones, and
`was soon joined by Bob Scheiffler who had extensive distributed computing expe-
`rience from the X Windowsproject that he ran. This put together the original core
`architectural team: Jim, Ann, Ken, and Bob.
`Asthe team grew, many people had a handin the direction of variousparts of
`the architecture, including Bryan O’Sullivan who took over the design of the
`lookup discovery protocol. Mike Clary took the project under his wing to give it
`time to grow. Mark Hodapp joined the team to manageits software development
`and run it in partnership with its technical leadership. Gary Holness, Zane Pan,
`Brian Murphy, John McClain, and Bob Resendesall reviewed the primary archi-
`tecture documents and had responsibility for various parts of the tool design,
`implementation design, and the implementations themselves. Laird Dornin and
`Adrian Colley joined the RMI sub-team to continue and expand its development.
`Charlie Lamb joined the architectural team to oversee work with outside compa-
`nies, starting with printing and storage service standards. Jen McGinn joined the
`team to document what we had done,later with the help of Susan Snyder on pro-
`duction support. Jimmy Torres started out as our release engineer and has changed
`to working on helping build our public developer community. Frank Barnaby took
`over the release engineering duties. Helen Leary joined early and kept our infra-
`structure humming along.
`Our QA team was Mark Schuldenfrei and Anand Dhingra, managed by Bren-
`dan Daly. Alan Mortensen wrote the conformance tests and their infrastructure.
`Emily Suter and Theresa Lanowitz started out our marketing team, with Franc
`Romano, Donna Michael, Joan MacEachern, and Paula Kozak joining later. Jim
`Hurley started setting up our support organization, and Keith Thompson and Peter
`Marksjoined to work on sales engineering. Samir Mitra led a marketing and busi-
`ness development
`team that
`included Jon Bostrom, Jaclyn Dahlby, Mike
`McNermy, Miko Matsamura, Darryl Mocek, Sharam Moradpour, and Vince
`Vasquez. Many others, too numerous to mention, did important work that made
`the Jini architecture possible andreal.
`
`
`'
`
`Jini is not an acronym. To rememberthis, think ofit as standing for “Jini Is NotInitials.”
`It is pronounced the sameas “genie.”
`
`
`
`18
`
`18
`
`
`
`XXxii
`
`ACKNOWLEDGMENTS
`
`PREFACE
`
`Asthe specifications were written, almost every memberof the team made impor-
`tant contributions. Their namesare listed above; we note the fact here to express
`our gratitude.