Examples
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
The following simple client example uses the CANCEL-REQUESTS-AFTER( ) method:
|
The following is a more complex example with both client and remote procedures
that demonstrate use of both the CANCEL-REQUESTS-AFTER( ) method and
the STOP AFTER phrase, which starts a timer on DO
blocks on both the client and server. This is the remote procedure,
srvrNested3.p:
|
This is the client procedure that asynchronously invokes the remote procedure (srvrNested3.p):
|
With this local procedure, the CANCEL-REQUESTS-AFTER( ) method is called on the server handle to
establish a time limit of 10 seconds for remote asynchronous procedures; if the timer is
already active, the time limit is reset to 10 seconds. The srvrNested3.p is run asynchronously on the server from within a block
that specifies a time limit of 5 seconds. The remote procedure does not implicitly adopt
the 5 second time limit of the local procedure (as would be the case for running a
synchronous remote procedure). In this example, the local time limit of 5 seconds is
essentially irrelevant, since it only times the RUN
statement. Since this is an asynchronous RUN, it
returns immediately after sending the request.
If the response to the request returns before 10 seconds has
elapsed, the event procedure remoteProcHandler is
run.
If the time limit is exceeded before the response returns, the client session
calls CANCEL-REQUESTS( ) method on the server handle.
This will cause a STOP message to be sent to the server
running the asynchronous request. As with remote synchronous requests, this will cause
the STOP condition to be raised in the server
application. Depending on the STOP handling logic in
the server application, the STOP condition may be
returned to the client application in the response. This is indicated by the STOP attribute in the asynchronous request handle, which is
set to TRUE prior to running the event procedure.
It is important to note that the time limit for the asynchronous
remote procedure call restarts each time the CANCEL-REQUESTS-AFTER( ) method
is called. This effectively extends the time limit for any asynchronous
requests that have already been run (or queued to run) on that server
handle.