7.2 States
Prev | 7 Hosted Application Life Cycle | Next

## 7.2 States

Figure 7.2-1 shows the state diagram for a Hosted Application. The states are defined in Table 7.2-1.

Table 7.2-1. States

State | Description
--- | ---
IDLE | In IDLE state the Hosted Application is waiting for a new task assignment from the Hosting System. This is the initial state when the Hosted Application starts.
INPROGRESS | The Hosted Application is performing the assigned task.
SUSPENDED | The Hosted Application is stopping processing and is releasing as many resources as it can, while still preserving enough state to be able to resume processing.
COMPLETED | The Hosted Application has completed processing, and is waiting for the Hosting System to access and release any output data from Hosted Application.
CANCELED | The Hosted Application is stopping processing, and is releasing all resources with no chance to resume processing.
EXIT | The terminal state of the Hosted Application.

The transitions between states are described in Table 7.2-2.

Table 7.2-2. Transitions Between States

State | Trigger | New State
--- | --- | ---
not started | Hosting System launches the Hosted Application (e.g., run, exec). | IDLE
IDLE | Hosting System calls Application.setState (EXIT). | EXIT
IDLE | Hosting System calls Application.setState (INPROGRESS). | INPROGRESS
INPROGRESS | Hosting System calls Application.setState (SUSPENDED). | SUSPENDED
INPROGRESS | Hosting System calls Application.setState (CANCELED). | CANCELED
INPROGRESS | Hosted Application encounters an error that prevents further processing, but is still healthy enough to perhaps start another task. The Hosted Application shall report this error through a call to notifyStatus() with a statusType of FATALERROR prior to transitioning to the CANCELED state. | CANCELED
INPROGRESS | Hosted Application finishes its processing. | COMPLETED
SUSPENDED | Hosting System calls Application.setState (INPROGRESS). | INPROGRESS
SUSPENDED | Hosted Application encounters an error (e.g., during suspension) that prevents further processing, but is still healthy enough to perhaps start another task. The Hosted Application shall report this error through a call to notifyStatus() with a statusType of FATALERROR prior to transitioning to the CANCELED state. | CANCELED
SUSPENDED | Hosting System calls Application.setState (CANCELED). | CANCELED
COMPLETED | Hosting System calls Application.setState (IDLE), after capturing all pertinent output data from the Hosted Application. | IDLE
CANCELED | Hosted Application releases all resources and is ready for the next task. | IDLE

The Hosted Application notifies the Hosting System of all state transitions by calling the notifyStateChanged() method.

### Note

If a Hosted Application does not respond to state change requests made by the Hosting System, the Hosting System may 'hard abort' the Hosted Application in some implementation specific manner, such as by killing the process in which the Hosted Application is executing.

Figure 7.2-1. State Diagram of Hosted Applications.

Prev | Up | Next
7 Hosted Application Life Cycle | Home | 8 Interfaces