Using activity timers

Use activity timers to restart processes that are stuck because of application errors or other reasons. For example, a parent might set a timer that causes it to be reactivated after a specified period, if a particular child activity does not complete.

About this task

The best way to restart processes that are stuck for other reasons - including application errors - is to use timers. The parent names the timer in a way that associates it with a particular child. If the child completes within the specified period, the parent deletes the timer.

One reason for making the application responsible for restarting itself is that it is difficult from outside a process to tell whether the process is stuck or merely dormant, particularly if the process is long-lived. Processes of different types can have varying "natural" lifespans; and these lifespans can vary according to system load, availability of remote regions, and so on. The application itself is best placed to know how long each of its activities should run before they can be assumed to be stuck.

You probably do not want to set timers for all your activities. For example, you might think it unnecessary to set a timer for a simple activity that completes its processing in one activation, has no children, and is to be run synchronously. However, you might want to set a timer for an activity to which one or more of the following apply:
  • It is to be run asynchronously.
  • It requires multiple activations to complete its processing.
  • It is long-lived.
  • It involves external interaction—for example, user input.


dfhp9c0082.html | Timestamp icon Last updated: Monday, 5 June 2017