
CHAPTER 23
Endpoint Interface
23-22 Using the Endpoint Interface
The cancellation itself can be invoked asynchronously or synchronously, and is
handled differently in the system depending on how it’s done. The details are
explained in the following subsections.
Asynchronous Cancellation 23
Cancellation can be invoked asynchronously in the following ways:
■ calling the Cancel method asynchronously, or calling the Disconnect
method asynchronously with the
cancelPending parameter set to true
■ having a time-out expire for an asynchronous request
When cancellation is invoked asynchronously, the system first cancels all pending
asynchronous requests. This means that the
CompletionScript message is sent
to the callback spec for each of these requests, and the
CompletionScript
result parameter is set to –16005.
Note
When calling Cancel asynchronously, it is possible that
additional asynchronous requests might be queued (by a
CompletionScript method) after the Cancel request is
queued but before it is executed. These additional requests will
fail with error –36003 since they will be processed after the
cancel process begins. In fact, any endpoint request that is made
while a cancel is in progress will fail with error –36003.
◆
Next, the cancel request itself completes by sending the CompletionScript
message. This message is sent to the callback spec passed to the
Cancel (or
Disconnect) method. Or, if the cancellation was invoked as the result of a
time-out expiration, the
CompletionScript message is sent to the callback spec
of whatever method timed out (or to the input spec, if input was in progress).
Finally, any pending synchronous request is canceled by throwing an exception that
contains error code –16005.
Synchronous Cancellation 23
Cancellation can be invoked synchronously in the following ways:
■ calling the Cancel method synchronously, or calling the Disconnect method
synchronously with the
cancelPending parameter set to true
■ having a time-out expire for a synchronous request
When cancellation is invoked synchronously, the system first cancels any pending
asynchronous requests. This means that the
CompletionScript message is sent
to the callback spec for each of these requests, and the
CompletionScript
result parameter is set to –16005.
Commentaires sur ces manuels