next up previous contents
Next: Future Improvements Up: The Interface Services Previous: Future Improvements

The HsCommunicator Service

  Now that we have a method of processing different types of external commands within Haystack we should briefly discuss the two services within Haystack that currently use the HsCommandAPI. We can view these two services as handling the ``transport'' layer between outside functions and the HsCommandAPI.

The first, the HsCommunicator service, acts as a network socket based interface. The service starts up within its own thread space and listens to incoming connections on a given port (5776 by default). These connections are passed off to CommunicatorThread objects (in the haystack.service.misc package). The CommunicatorThread objects are themselves threads which allow the HsCommunicator to handle multiple calls simultaenously. The CommunicatorThread objects simply read the input from the socket and submit the text to the HsCommandAPI.

There are a number of utility functions within the HsCommunicator that allow for the cleanup of all CommunicatorThread objects. We would like Haystack to shutdown when the close() operation is invoked on the HsCommunicator it will run through the CommunicatorThreads it knows about and shuts them down. To do this, the HsCommunicator maintains a list of all running CommunicatorThread objects.





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