Core Jini: Overview and Updates
Core Jini Overview
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
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
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
Downloadable Code
Bug fixes and errata for the Second Edition
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
Bug fixes and errata for the First Edition
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
/files/corejini ,
for example) in addition to whatever other directories and JARs are specified.
Chapter 5
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
Finally, instead of copying the proxies into the Chapter 6
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
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
Federate.java . The lines that read
locs[0] = loc2; jadmin2.addLookupLocators(locs);Should be: locs[0] = loc2; jadmin1.addLookupLocators(locs);
The version of 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
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
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 Chapter 13
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.
|
Keith Edwards
kedwards@kedwards.com