Cancellation
A request can be canceled for a number of reasons. The Admin API or Administration Tool can directly cancel requests. Canceling a Service Session cancels a request. If the killCancelledTasks option is true for this Service, the Engine process exits and the Engine restarts. (By default, the killCancelledTasks option is true, except for .NET Services, where it is false by default.) However, in many cases, it is not necessary to do so, and you would prefer to interrupt the calculation so that the Engine becomes immediately available.
In this case, set the killCancelledTasks option to false, implement a cancelMethod, and register it on the Service type. This method must interrupt any Service method that is in process. It is also possible to call cancelMethod after the Service method finishes processing, so the implementer must take this into account.
|
Note |
Use the |
A typical use case is a calculation that periodically checks a cancel flag. The cancel method would set that flag, interrupting the calculation.