Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Managing the service life cycle
 

Managing the service life cycle

It is your responsibility to delete the service to release memory when the service is no longer needed. The service and the classes retrieved by the service are not automatically garbage collected, because of the complexity of object references among them. The service needs to remain alive while working on any object retrieved by the service. Deleting the service will also delete all objects retrieved by the service. For example:
define variable service as DataAdminService no-undo.
service = new DataAdminService("sportsmt").
/* API operations that instantiate or retrieve objects */
. . .
delete object service.
The service can be started and stopped per request or function or kept alive during the session. The service can accumulate a rather large amount of objects and data over time and is not particularly expensive to start and it is likely to be more efficient to bundle the start and stop of the service with each operation rather than keeping the same service alive for multiple operations. On the other hand, there is some overhead involved with each first reference to a type of entity, so multiple operations on the same type of instances will be more efficient using the same service. Instances realized through the New*( ) or Get*( ) methods in the service have to be passed to corresponding Create*( ) or Update*( ) methods of the same service instance.
One can start multiple instances of the service simultaneously. The intention is that one service is started per connected database. It is possible to start many services per database, but this will cause stale data and schema locks if more than one service operates on the same data. This can also happen if the service operates on entities that are also being updated by OpenEdge data administration tools.
Note: Passing instances realized through New*( ) or Get*( ) methods in the service to Create*( ) or Update*( ) methods of another service is unsupported. Such operations normally throw an error, but are unsupported even if they work without error: they are likely to throw an error in a future release.