Issue 17314: Structured activity node activations do not wait for contained accept event action activations (fuml-rtf) Source: Model Driven Solutions (Mr. Ed Seidewitz, ed-s(at)modeldriven.com) Nature: Uncategorized Issue Severity: Summary: Specification: Semantics of a Foundational Subset for Executable UML Models (fUML) (formal/2011-02-01) Subclauses: 8.5.2.2.5 ActivityNodeActivationGroup, 8.5.3.2.4 StructuredActivityNodeActivation, 8.6.4.2.1 AcceptEvent ActionActivation When a structured activity node contains one or more accept even actions, then, when those actions are waiting for the reception of event occurrences, one would expect that the structured activity node as a whole would also be waiting, pending the triggering of the actions. As currently specified, when accept event action activation registers to wait for event dispatching, it is not considered to be complete. Nevertheless, once all such actions have registered, and all other contained in a structured activity node have completed, the running of the node activations in the activation group for the structured node finishes, and the structured activity node activation completes, allowing execution to continue to subsequent nodes. This is not correct; the structured activity node activation should essentially be suspended until all the accept event actions activations have actually completed. Resolution: agreed Revised Text: In Figure 8.26, add the operations “suspend()” and “resume()” to the class ActivityNodeActivation, and add the following specifications for them to Subclause 8.5.2.2.4: suspend() // Suspend this activation within the activation group that contains it. this.group.suspend(this); resume() { // Resume this activation within the activation group that contains it. this.group.resume(this); In Figure 8.25, add an association from ActivityNodeActivationGroup to ActivityNodeActivation with end name suspendedActivations and multiplicity *, and add the following description of it to Subclause 8.5.2.2.5: • suspendedActivations: ActivityNodeActivation [*] Activity node activations in this activation group that are suspended waiting for an event occurrence. If an activation group has a containing node activation and any suspended activations, then the containing node activation will also be suspended. In Figure 8.25, add the operations “isSuspended(): Boolean”, “suspend(activation: ActivityNodeActivation)” and “resume(activation: ActivityNodeActivation)” to the class ActivityNodeActivationGroup, and add the following specifications for them to Subclause 8.5.2.2.5: isSuspended(): Boolean // Check if this activitation group has any suspended activations and is, // therefore, itself suspended. return this.suspendedActivations.size() > 0; suspend(activation: ActivityNodeActivation) // Suspend the given activation in this activation group. If this is // the only suspended activation, and the activation group has a // containing node activation, then suspend that containing activation. if (!this.isSuspended()) { StructuredActivityNodeActivation containingNodeActivation = this.containingNodeActivation; if (containingNodeActivation != null) { containingNodeActivation.suspend(); } } this.suspendedActivations.addValue(activation); resume(activation: ActivityNodeActivation) // Resume the given activation by removing it from the suspended // activation list for this activation group. If this is the last // suspended activation, and the activation group has a containing // node activation, then resume that containing activation. boolean found = false; int i = 1; while (!found & i <= this.suspendedActivations.size()) { if (this.suspendedActivations.get(i-1) == activation) { this.suspendedActivations.removeValue(i-1); found = true; } i = i + 1; } if (!this.isSuspended()) { StructuredActivityNodeActivation containingNodeActivation = this.containingNodeActivation; if (containingNodeActivation != null) { containingNodeActivation.resume(); } } In Figure 8.28, add the operations “isSuspended(): Boolean”, “completeAction(): Token[*]” and “resume()” to the class StructuredActivityNodeActivation, and add the following specifications for them in Subclause 8.5.3.2.4: isSuspended(): Boolean // Check if the activation group for this node is suspended. return this.activationGroup.isSuspended(); completeAction(): Token[*] // Only actually complete this structured activity node if it is not // suspended. TokenList incomingTokens = new TokenList(); if (!this.isSuspended()) { incomingTokens = super.completeAction(); } return incomingTokens; resume() // Only actually complete this structured activity node if it is not // suspended. TokenList incomingTokens = new TokenList(); if (!this.isSuspended()) { incomingTokens = super.completeAction(); } return incomingTokens; In Section 8.6.2.2.1 ActionActivation, in the operation fire, replace the body of the specification after the initial comment block with do { Debug.println("[fire] Action " + this.node.name + "..."); Debug.println("[event] Fire activity=" + this.getActivityExecution().getBehavior().name + " action=" + this.node.name); this.doAction(); incomingTokens = this.completeAction(); } while (incomingTokens.size() > 0); In Figure 8.31, add the operation “completeAction():Token[*]” to the class ActionActivation, and add the following specification for it in Section 8.6.2.2.1: completeAction(): Token[*] // Concurrently fire all output pin activations and offer a single // control token. Then check if the action should fire again // and, if so, return additional incoming tokens for this. this.sendOffers(); Debug.println("[fire] Checking if " + this.node.name + " should fire again..."); _beginIsolation(); TokenList incomingTokens = new TokenList(); this.firing = false; if (this.isReady()) { incomingTokens = this.takeOfferedTokens(); this.firing = this.isFiring() & incomingTokens.size() > 0; } _endIsolation(); return incomingTokens; In Subclause 8.6.4.2.1 AcceptEventActionActivation, in the accept operation, in the if statement, after “this.receiveOffer()”, add the statement: this.resume(); In the fire operation, at the end of the specification, add the statement: this.suspend(); Actions taken: April 16, 2012: received issue January 7, 2013: closed issue Discussion: End of Annotations:===== m: Ed Seidewitz To: "issue@omg.org" Date: Mon, 16 Apr 2012 22:14:28 -0400 Subject: Structured activity node activations do not wait for contained accept event action activations Thread-Topic: Structured activity node activations do not wait for contained accept event action activations Thread-Index: Ac0cKSv8kBlNQPfrTze0vBtfzCdphQ== Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US X-Mailprotector-Decision: deliver X-Mailprotector-Connection: TLSv1|[10.1.50.226]|10.1.50.226|outbound.mailprotector.net|0|0|0|new|ugly|0|0|0|0 X-Mailprotector-Results: null_ptr subject_50_chars subject_10_spaces clean X-Mailprotector-Score: 80 X-Mailprotector-IP-Analysis: 0, 10.1.50.226, Ugly c=0 p=0 Source New X-Mailprotector-Scan-Diagnostics: 0-0-0-7729-c X-Mailprotector-ID: 91ea2675-7573-4cdb-a3c0-9099b565c8dc Specification: Semantics of a Foundational Subset for Executable UML Models (fUML) (formal/2011-02-01) Subclauses: 8.5.2.2.5 ActivityNodeActivationGroup, 8.5.3.2.4 StructuredActivityNodeActivation, 8.6.4.2.1 AcceptEvent ActionActivation When a structured activity node contains one or more accept even actions, then, when those actions are waiting for the reception of event occurrences, one would expect that the structured activity node as a whole would also be waiting, pending the triggering of the actions. As currently specified, when accept event action activation registers to wait for event dispatching, it is not considered to be complete. Nevertheless, once all such actions have registered, and all other contained in a structured activity node have completed, the running of the node activations in the activation group for the structured node finishes, and the structured activity node activation completes, allowing execution to continue to subsequent nodes. This is not correct; the structured activity node activation should essentially be suspended until all the accept event actions activations have actually completed.