Providing support for object lifetime control
MTS, like Jaguar CTS and other object frameworks, notifies
components about lifetime actions with activate and deactivate methods.
Because MTS does not currently support instance pooling, when
a new client calls a method on a PowerBuilder COM component running
in MTS, its Constructor event is triggered and then its Activate
event is triggered. When the client or the component itself calls
SetComplete or SetAbort, the component’s Deactivate event
is triggered followed by its Destructor event.
You can place context-specific initialization and cleanup
code in the object’s Activate and Deactivate events.
If you used the COM/MTS Component Start or Object
wizards to create the custom class user object, the Activate and
Deactivate events are defined for you. If you did not use the wizards
or you are modifying an existing custom class user object, you can
add the events yourself.
To add an event to a custom class user object, select Insert>Event
from the menu bar and define the event in the Prototype window.
The Activate and Deactivate events must be mapped to the appropriate
event ID as follows:
|Event Name||Event ID|