As mentioned previously, a service is a logical concept such as a blender, a chat service, or a disk. It will usually turn out to be defined by a Java interface, and often the service itself will be identified by this interface. Each service can be implemented in many ways, by many different vendors. For example, there may be Joe's dating service, Mary's dating service, and any number of others. What makes them the "same" service is that they implement the same interface; what distinguishes one from another is that each different implementation uses a different set of objects (or maybe just one object) belonging to different classes.
A service is created by a service provider. A service provider plays a number of roles:
It creates the objects that implement the service.
It registers one of these objects, the service object, with lookup services. The service object is the publicly visible part of the service, and it will be downloaded to clients.
It stays alive in a server role, performing various tasks such as keeping the service "alive."
In order for the service provider to register the service object with a lookup service, the server must first find the lookup service. This can be done in two ways. If the location of the lookup service is known, then the service provider can use unicast TCP to connect directly to it. If the location is not known, the service provider will make UDP multicast requests, and lookup services may respond to these requests. Lookup services will be listening on port 4160 for both the unicast and multicast requests. (Port 4160 is the decimal representation of hexadecimal (CAFEBABE). Oh well, these numbers have to come from somewhere.) When the lookup service gets a request on this port, it sends an object back to the server. This object, known as a registrar, acts as a proxy to the lookup service and runs in the service's JVM. Any requests that the service provider needs to make of the lookup service are made through this proxy registrar. Any suitable protocol may be used to do this, but in practice the implementations that you get of the lookup service (such as those from Sun) will probably use RMI.
What the service provider does with the registrar is register the service with the lookup service. This involves taking a copy of the service object and storing it on the lookup service as shown in Figures 1-4, 1-5, and 1-6. Production: AU requests that we don't delete the following image references at this stage, as he's going to use them for the next online version of the book. Figure Overview of Jini.4, “Figure 1-4. Querying for a service locator”, Figure Overview of Jini.5, “Figure 1-5. Registrar returned” and Figure Overview of Jini.6, “Figure 1-6. Service uploaded”.