Try OpenEdge Now
skip to main content
Application Migration and Development Guide
Application Development with PAS for OpenEdge : Programming ABL Client Applications : Managing asynchronous requests : Canceling asynchronous requests
 
Canceling asynchronous requests
You can cancel all asynchronous requests that are executing or pending on behalf of the client on a particular server by executing the CANCEL-REQUESTS( ) method on the server object handle. This method raises the STOP condition in the context of the asynchronous procedure currently executing and causes results to be returned for any pending asynchronous requests, as described in the following paragraph.
The associated event procedures execute for all canceled requests the next time the client blocks for I/O or executes the PROCESS EVENTS statement. Each event procedure receives the following results, depending on the final state of its corresponding asynchronous request:
*Any request that is completed at the time of cancellation but whose event procedure has not yet run — The event procedure receives all input parameters passed from the request, and the COMPLETE attribute on the asynchronous request handle (SELF) is set to TRUE. This is the same result as a normal asynchronous request completion.
*Any request that is executing and that is stopped in response to the CANCEL-REQUESTS( ) method — The event procedure input parameters are set to the Unknown value (?), and the COMPLETE attribute on the asynchronous request handle (SELF) is set to TRUE. If the stopped request does not handle the STOP condition raised by the CANCEL-REQUESTS( ) method, the STOP attribute on the asynchronous request handle (SELF) is also set to TRUE. This is the same result as if the STOP condition were raised in the server session running the request.
*Any request that is removed from the send queue prior to its execution — The event procedure input parameters are set to the Unknown value (?) (or unchanged for TEMP-TABLE parameters), and the CANCELLED attribute on the asynchronous request handle (SELF) is set to TRUE. This result can only occur for a request that is canceled while waiting for execution.
Note: If you disconnect a server using the DISCONNECT( ) method, this also cancels all asynchronous requests still running or pending on the server for this particular client. For more information, see Disconnecting from a PAS for OpenEdge instance.