One of the more confusing aspects of server-side applications is the number of TCP servers that might start up. The standard Dynamo configuration, for example, starts between four and six separate TCP servers. To help organize these servers, Dynamo includes a service called atg.service.portregistry.PortRegistry that keeps track of which services have started servers on which ports. The PortRegistry has a Nucleus address of /atg/dynamo/server/PortRegistry. This component’s page in the Component Browser lists which services are using which ports.

The PortRegistry does not automatically find server components. Instead, individual server components are expected to register themselves with the PortRegistry.

Every subclass of RequestServer already has the ability to automatically register with a PortRegistry when it starts up. To do this, the component must be configured with a property that points to the PortRegistry. For example, the HTTP server in Dynamo might be configured like this:

portRegistry=/atg/dynamo/server/PortRegistry

If you create a server component that does not extend RequestServer, then your component should define a portRegistry property to be set in the configuration file. When it starts, it should register itself with the PortRegistry like this:

if (getPortRegistry () != null) {
  getPortRegistry ().addEntry (getPort (), getAbsoluteName ());
}

Note that this assumes that port is available as a property. The getAbsoluteName method is available only if your server component extends atg.nucleus.GenericService. If you extend GenericService, then this code will most likely appear inside your doStartService method. Also, your doStopService method should include the following code:

if (getPortRegistry () != null) {
  getPortRegistry ().removeEntry (getPort (), getAbsoluteName ());
}
 
loading table of contents...