The 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.

The Thread Manager is the recommended way to spawn threads in Java or C++ components. In C++, using the Thread Manager avoids system-level thread calls that may affect portability. In Java and C++, components running in the Thread Manager can make in-memory intercomponent calls, whereas components running in user-spawned threads must make intercomponent calls through the network.

You can use the Thread Manager and service components together. For example, you might code a simple service component that spawns threads in the start or run method, and stops them in the stop method.

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. In the services start or run method, spawn threads that do the service's processing. In the service's stop method, call the Thread Manager stop method to halt the threads. For more information, see the Application Techniques manual in the PowerBuilder documentation.