The Deactivate procedure executes immediately after remote procedure and delete procedure requests when the connection is in the session-free or session-managed in the unbound state. A typical use of Deactivate procedures for unbound session-managed connections is to store connection context to be saved from the session that just completed the current request using an application-specific context database or using the SERVER-CONNECTION-CONTEXT attribute on the SESSION handle. For more information, see Managing context for bound and unbound session-managed connections. Using the SERVER-CONNECTION-ID attribute, you can uniquely identify (key) the context in the context database. You can then gather the context identified with the connection and its just completed request and store it in the context database or marshal it into the SERVER-CONNECTION-CONTEXT attribute.
For either session-free or unbound session-managed connections, you can also store connection context keyed on the value of the ClientContextId property of the Progress.Lang.OERequestInfo class. From the Activate (or any other PAS for OE instance) procedure, you can access this property on the OERequestInfo object that is returned by the CURRENT-REQUEST-INFO attribute on the SESSION handle. For more information, see Managing client context for session-free and unbound session-managed connections.
You can specify the name of an PAS for OpenEdge Deactivate procedure by setting the sessionDeactivateProc property in the PAS for OpenEdge properties file (openedge.properties). If you specify this procedure, it accepts no parameters and runs as a non-persistent procedure after the request executes, but before any response is returned to the client. Also, the Deactivate procedure runs only if a session-managed connection is unbound when the request completes execution.
A session-managed connection can be in the unbound or the bound state when a request is initiated and can change to the opposite state before the request completes execution. If the connection ends up in the bound state during execution of the request, the Deactivate procedure does not run when the request completes. However, if a session-managed connection ends up in the unbound state, the Deactivate procedure runs even if the original request completes with some ABL termination condition (ERROR, QUIT, or STOP).
After a delete procedure request, the Deactivate procedure runs only if a session-managed connection is unbound. The connection can become unbound only if both of the following are true:
The deleted procedure was the last instantiated remote persistent procedure for the connection
The SERVER-CONNECTION-BOUND-REQUEST attribute has a value of FALSE
Note: The Deactivate procedure only runs following remote procedure and delete procedure requests. It does not run in response to new connection or disconnection requests.
For the purposes of error handling, only return values from the request (or any executed Activate procedure) are passed to the client. Any return values generated by the Deactivate procedure, itself, are ignored.