One of the more confusing aspects of server-side applications is the number of TCP servers that might start up. The standard configuration for an Oracle ATG Web Commerce application, for example, starts between four and six separate TCP servers. To help organize these servers, Oracle ATG Web Commerce includes a service called atg.service.portregistry.PortRegistry that keeps track of which services 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 might be configured like this:

portRegistry=/atg/dynamo/server/PortRegistry

If you create a server component that does not extend RequestServer, 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: 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, this code most likely appears inside your doStartService method. Also, your doStopService method should include the following code:

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


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved.

Legal Notices