Architecture

This chapter looks at internal structures of Jini. This is heavily based on the 1.0 implementation by Sun, and may not be valid for any future implementations either by Sun or other vendors.

Contents

  1. Threads
    1. LookupDiscovery threads
    2. LeaseRenewalManager threads

1. Threads

Jini uses many threads in its internal workings. The knowledge of these is not important to using Jini, but some may find it valuable to know what is going on under the hood.

1.1 LookupDiscovery threads

A multicast request is made by creating a new LookupDiscovery object with a non-empty set of groups, or by calling setGroups(). This must broadcast the service, looking for service locators. This is done using a thread of type Requestor. This creates a MulticastSocket, sets its time-to-live field and sends out a number (currently eight) of announcements

A class ResponseListener is used to handle replies. This runs as its own thread. It listens on a socket for responses and adds them to a list of service locators. If a new locator is found, then it calls each DiscoveryListener. (The implementation is slightly more complex due to timing issues - see the source code.)

Both of these run as daemon threads. That means they run as background threads. A user thread is needed to keep the application alive: an application will terminate if there are only daemon threads alive.

1.2 LeaseRenewalManager threads

A LeaseRenewalManager uses a thread of class RenewThread. This thread looks after all aspects of renewal.

This file is Copyright ©Jan Newmarch (http://jan.newmarch.name) jan@newmarch.name

The copyright is the OpenContent License (http://www.opencontent.org/opl.shtml), which is the ``document'' version of the GNU OpenSource license.