Chapter 33 Creating Service Components
Service components perform background processing or provide common services for Jaguar clients and other Jaguar components. For example, you might create service components to perform the following tasks:
Service components are like any other Jaguar component, except that:
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.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.See Chapter 32, "Using the Thread Manager" for
more information.
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 Jaguar Manager.
Jaguar server calls the CtsServices::GenericService methods to indicate transitions in the service's state:
Service components that make intercomponent calls
If your start method makes intercomponent
calls, check the
com.sybase.jaguar.server.bindrefresh
property
for the servers where your component is installed. Use the All Properties
tab in the Server Properties dialog box to view and change this
property. This property must be set to "start" to
allow name service lookups in the start method
of service components. The default setting is "run".
Your component can implement additional interfaces. Jaguar 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, Jaguar 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 Jaguar calls the run() method.
Copyright © 2000 Sybase, Inc. All rights reserved. |
![]() |