Introduction

Service components perform background processing or provide common services for EAServer clients and other EAServer components. For example, you might create service components to perform the following tasks:

What are service components?

Service components are like any other EAServer component, except that:

NoteThe Thread Manager and service components You can use the Thread Manager as an alternative to creating a service component to handle repetitive processing. You may find the Thread Manager interface allows more design flexibility. For example, you can suspend processing in services run by the Thread Manager, and you can start threads at any time rather than only at server start-up. Chapter 32, “Using the Thread Manager” describes how to use the thread manager.

PowerBuilder developers can use the Thread Manager to develop more robust services. Since PowerBuilder components cannot support sharing and concurrency, you cannot develop a service that can be stopped or refreshed without using the Thread Manager. For more information, see the Application Techniques manual in the PowerBuilder documentation.

The GenericService interface

Your component implementation must implement all the methods in the CtsServices::GenericService interface. Your implementation does not need to explicitly implement the interface (that is, list it in the implements clause of the class declaration), and you do not need to list the interface in the component’s Interfaces folder in EAServer Manager.

EAServer calls the CtsServices::GenericService methods to indicate transitions in the service’s state:

Implementing other interfaces

Your component can implement additional interfaces. EAServer clients, servlets, and other components can execute a service component’s methods like those of any other component, with one exception: Clients cannot invoke methods on the service component until the start() method has returned. This restriction allows you to perform required initialization in start() without worrying about thread synchronization issues.

After start() returns, EAServer calls the run() method in its own thread. Client method invocations may arrive at this time as well. There is no guarantee that run() will have been called when a client method invocation occurs; the first client invocations may arrive before EAServer calls the run() method.