Creating timeouts
About this task
The notation for timeouts is like the notation for events sent by an object to itself. There are two differences:
- A timeout starts with a small box.
- The name is a
tm(x)
.
The label on a timeout arrow is a parameter specifying the length of the timeout. Timeouts are always messages-to-self.
When designing a software system, you can establish waiting states, during which your program waits for something to occur. If the event occurs, the timeout is canceled. The sequence diagram shows this with a canceled timeout symbol. If it does not happen, the timeout wakes up the instance and resumes with some an error recovery process. Canceled timeouts are always messages-to-self.
For example, on a telephone, a dial tone waits for you to dial. The telephone has a timeout set so if you do not dial, the dial tone changes to a repeating beep. If you do dial, the timeout is canceled.
A canceled timeout occurs automatically once the state on which the timeout is defined is exited. As a designer, you do not need to do anything to cancel a timeout. The framework has a call to cancel a timeout, but you do not need to use it because the code generator inserts it automatically.