The state of an execution is either active or locked. An active execution is either executing or waiting for an external trigger. If an execution is not in {@link #STATE_ACTIVE}, then it is locked. A locked execution is read only.
When a new execution is created, it is in {@link #STATE_ACTIVE}. To change the state to a locked state, use {@link #lock(String)}. {@link #STATE_ACTIVE Some STATE_* constants} are provided that represent the most commonly used locked states. But the state '...' in the picture indicates that any string can be provided as the state in the lock method.
If an execution is locked, methods that change the execution will throw a {@link PvmException} and the message will reference the actual locking state.{@link #fire(String,ObservableElement) Firing events}, {@link #setVariable(String,Object) updating variables}, {@link #setPriority(int) updating priority} and {@link #addComment(String) adding comments} are not considered to change an execution. Also {@link #createExecution(String) creation} and {@link #removeExecution(Execution) removal} of child executions are unchecked, which means that those methods can be invoked by external API clients and node behaviour methods, even while the execution is in a locked state.
Make sure that comparisons between {@link #getState()} and the {@link #STATE_ACTIVE STATE_* constants} are done with .equals and not with '==' because if executions are loaded from persistent storage, a new string is created instead of the constants.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|