Core Jini: Overview and Updates

NEW!   is out now! This new version is:
  • Completely updated for Jini 1.1 (not alpha, not beta or beta2, but the official, final release of 1.1).
  • Way more code: multiple examples on how to use the ServiceDiscoveryManager, the new 1.1 helper services, basic RMI-based services, and so on.
  • Updated with more information about pitfalls and troubleshooting (I tried to distill down the most common Jini questions that I hear and made sure they were covered in the book).
  • Better step-by-step guides to building and running the example services in the book; better, tighter explanations of how Jini works.
I think this book is significantly better than the first edition, not only because it reflects where Jini has gone since Core Jini was first written, but because it reflects the many comments I've gotten from readers.

Click on the book's cover to jump to its page on Amazon.com.

Look for the new gold cover, and let me know what you think!




The first edition of Core Jini is still on shelves in some places, and covers Jini 1.0. This book provides an in-depth look at the philosophy behind Jini, its programming models, and its APIs. The book has a bunch (over 7,000 lines) of code, as well as a foreward by Bill Joy.

The book is part of the Sun Microsystems Java Series from Prentice-Hall. Let me know what you think!




NEW! Prentice-Hall helped me put together an interactive video course on Jini. Click here for more info. There are two packages available. One is a "complete set" that includes the Core Jini book, the videos, and an interactive web site. There is also a set available without (for folks who already have Core Jini).

This package has about 3 hours of video, and (I think) complements the book nicely.




The rest of this page is a repository of bug fixes, downloads, errata, and other information on Core Jini. I'll update this page periodically as changes roll in, new editions go to press, and I revise the code samples.

Core Jini Overview

    Core Jini is a professional software developer's guide to Sun's Jini distributed computing technology. The book is aimed at people building real-world Jini clients and services, and covers some advanced topics not covered by any other Jini book.

    The book's strength is in the amount of code in it. Core Jini Second Edition has about 9,000 lines of real code, and includes several complex services, a lookup browser, UI components, and other clients. The services include a printing service, a lease renewal service, a store-and-forward event mailbox, a lookup service tunnel, and others. These aren't quickie toy services: All of them correctly use persistence and leasing, and are "good citizens" in Jini communities.

    The book devotes an entire chapter to services' views of leasing, including a discussion of how to use the Landlord classes, which aren't covered in detail in any other book that I'm aware of. Another chapter covers service administration and service user interfaces.

    There's also extensive coverage (in the Second Edition) of new Jini 1.1 features, such as using the "utility" services to support disconnected operation, or services that can deactivate themselves. There are also a number of examples that cover what is perhaps the most important 1.1 feature: the ServiceDiscoveryManager

    One particular feature that will be useful to service developers is a service writer's toolkit. This toolkit handles persistence (how services can checkpoint their state and recover it after a restart or a crash), the join protocol, and even service administration. The toolkit provides a "plug-and-run" implementation of the JoinAdmin, StorageLocationAdmin, and DestroyAdmin interfaces that can be reused as needed.

Downloadable Code

    NEW! This is the code bundle for Core Jini Second Edition. The version here requires Jini 1.1 to compile and run. Note that if you still have the first edition of the book, you should note that the package names won't sync up with the chapter numbers in your copy... so see the README.txt file for details.
    Prentice-Hall put together a special pre-release of Core Jini Second Edition for JavaOne 2000. The version available there is based on Jini 1.1 beta. This snapshot reflects what's printed in that version, as well as the ebook. I'd recommend going with the final code for the Second Edition, above, but I've left this here in case you need it.
    The lastest code snapshot for the First Edition is available here. This code includes the bugfixes below, plus a couple of other minor tweaks. This snapshot is what's printed in later printings of Core Jini First Edition. I'll try to keep this snapshot up to date, if more bug fixes come in, but it may lag a bit.
    The original sample code from the book is available for download by clicking on the icon on the left. This is the code that came with the first printing of the book, and should be patched according to the instructions below.

Bug fixes and errata for the Second Edition

    Chapter 5
      Note that the printed version of HelloWorldServiceWithLeases differs slightly from the one on the web site. The version at the web site is correct (the one in the book has a typo that will cause a ClassCastException).

    Chapter 6

      In the instructions for the DiscoveryExample on page 210 omit the fact that you also need to compile PrintingListener. Simply make sure you build it when you build the DiscoveryExample class.

Bug fixes and errata for the First Edition

    I suppose any sizeable book will contain bugs in its first printing and, unfortunately, this one isn't an exception. I'm collecting bugs that I've found and that have been reported by diligent readers, and presenting them here.

    I'll continue to update this page as fixes and suggestions come in, and I'll update the book to fix these in later printings. Currently, I believe that everything below is fixed in the second printing of the book, and is reflected in the ZIP file above.

    If you do encounter a bug that's not listed here, please let me know!

    General

      In the instructions for compiling examples, make sure you pass in the top-level source directory to the classpath (/files/corejini, for example) in addition to whatever other directories and JARs are specified.

    Chapter 5

      In the HelloWorldClientWithEvents.java example, you need to be sure to add the client-dl directory to the classpath passed on the command line to the java executable. This is so that the program can find its event listener stub (which lives in client-dl) when it starts up.

      You also need to add this directory to the classpath for the later client examples, which are subclasses of the event example.

      Likewise, the activatable service example should have the service-dl directory on its classpath, so that it can find its RMI stub when it runs.

      Finally, instead of copying the proxies into the service-dl directory, they should go in service-dl/corejini/chapter5 so that they can be found properly.

    Chapter 6

      In the Unicast.java and LocatorExample.java programs, you need to be sure to install a security manager so that these programs can download the proxies for the lookup services they discover.

      In the main() routines for these programs, add:

           if (System.getSecurityManager() == null) {
      	 System.setSecurityManager(new RMISecurityManager());
           } 

      Also be sure to import this class at the top of the programs:

           import java.rmi.RMISecurityManager; 

    Chapter 8

      There's a typo in Federate.java. The lines that read
           locs[0] = loc2;
           jadmin2.addLookupLocators(locs); 
      Should be:
           locs[0] = loc2;
           jadmin1.addLookupLocators(locs); 

      The version of TunnelService.java printed in the book is correct, but a bug crept into the code bundle available on the Prentice-Hall FTP server.

      To fix the downloaded code, find the line:

           protected Listener listener = new Listener(); 
      And change it to:
           protected Listener listener; 
      (as in the book)

    Chapter 9

      The Browser.java file also needs a security manager installed. Follow the same directions as for the Unicast.java example in the Chapter 6 errata above.

    Chapter 11

      The SlotClient.java and SlotProvider.java examples also omit the security manager (whoops!) Same instructions as for Chapter 6, above.

      Also, the instructions for running the example don't mention that you should run the rmiregistry program from the Java distribution before running the example.

    Chapter 13

      The print service example in the book may have trouble rendering output on printers with large unprintable margins. To correct the problem, find the print() method in the PrintableString class (in Client.java). Find the line:
           g.drawString(s, 20, 60); 
      To ensure correct rendering on all printers, you need to offset the coordinates by the margin size for your printer. Change the above line to:
          int x = (int) pf.getImageableX();
          int y = (int) pf.getImageableY();
          g.drawString(s, x+20, y+60); 
      (This isn't a problem with the Jini interactions of the print service, just the rendering code.) Both the service and the client presented in the book leave out the required security manager also.

Go back to Jini Planet

Keith Edwards
kedwards@kedwards.com


Copyright 1999, W. Keith Edwards