next up previous contents
Next: Service Naming Up: The HaystackRootServer Previous: The HsService Class

The HsNameService

  The first important bootstrap service, beyond the HaystackRootServer object is the HsNameService which is loaded on initialization of HaystackRootServer. The idea is that one service can ask the HsNameService for a pointer to another service. The returned pointer can be ``cached'' by the querying service (so that calls to the HsNameService are minimized). Abstractly, the HsNameService maintains one table, mapping service name to the instantiated service object.

The ServiceName field refers to the name of the service. This name is unique to the Haystack in question, and is persistently maintained with the service. So if there are two services that load information from the Internet (so-called fetch services), they can be named fetch1 and fetch2, and the names will be bound to the particular code. If there is a collision between two names, the second service with the same name will not be loaded and the user of the system will be notified of the failure. It is therefore the programmer's responsibility to ensure that names for services are unique. Naming is elaborated on below. The service pointer field simply contains a pointer to an instantiated (in the Java sense) version of the service object.





Copyright 1998, Eytan Adar (eytan@alum.mit.edu)