Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C89766079 for ; Wed, 27 Jul 2011 06:43:20 +0000 (UTC) Received: (qmail 47056 invoked by uid 500); 27 Jul 2011 06:43:19 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 46603 invoked by uid 500); 27 Jul 2011 06:43:02 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 46515 invoked by uid 99); 27 Jul 2011 06:42:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 06:42:56 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of hynek.cihlar@gmail.com designates 74.125.83.43 as permitted sender) Received: from [74.125.83.43] (HELO mail-gw0-f43.google.com) (74.125.83.43) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2011 06:42:49 +0000 Received: by gwm11 with SMTP id 11so917987gwm.30 for ; Tue, 26 Jul 2011 23:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=+o6R1WuDFbfIfjKHjm5vpfvmBk29IaU9PZEKvzcPZVk=; b=r5443Hfyi8Xfer0D21Ay2ANLIhKei6kCAo4zBnSvu53XgtlaSFOQfO0bEHE/BRYlkz PSDr9+mKllKMU0wlhkUVg0nEQMXeVRVwQwnylIzSGectqOk/YsMiQYJs1xxjUN6w6Pw5 Bdgli/D4b7b20J+ytbIqiiXK+XbDa3+OKqCWo= Received: by 10.236.179.5 with SMTP id g5mr8606879yhm.461.1311748948194; Tue, 26 Jul 2011 23:42:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.43.167 with HTTP; Tue, 26 Jul 2011 23:42:08 -0700 (PDT) In-Reply-To: References: From: Hynek Cihlar Date: Wed, 27 Jul 2011 08:42:08 +0200 Message-ID: Subject: Re: [scxml] A local transition to a parallel sub-state affects all its parent's siblings To: Commons Users List Content-Type: multipart/alternative; boundary=20cf303a2b3d17748f04a9075ad5 X-Virus-Checked: Checked by ClamAV on apache.org --20cf303a2b3d17748f04a9075ad5 Content-Type: text/plain; charset=ISO-8859-1 Rahul, thank you for your clear explanation. The internal transitions would be the best solution for my use case (and also the default behavior I would personally expect). In terms of implementing internal transitions, I came across a thread from James Barnett who claims to have them (and other standard features) implemented. Here's the link, http://apache-commons.680414.n4.nabble.com/scxml-removing-superstep-etc-td690740.html. Would you know if there was any subsequent progress? Thanks, Hynek On Tue, Jul 26, 2011 at 9:14 PM, Rahul Akolkar wrote: > On Mon, Jul 25, 2011 at 6:31 AM, Hynek Cihlar > wrote: > > I have come across the following case, where I believe the Commons SCXML > > behaves incorrectly. > > > > Assuming the following state machine configuration: > > > > > xmlns:cs="http://commons.apache.org/scxml" > > version="1.0" > > initialstate="parallel"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > First the event "anEvent" is triggered to bring the parallel states "A" > and > > "B" from their initial states. Now, after triggering the event "anAEvent" > I > > would expect only the state of "A" to be changed. Surprisingly the event > has > > also effect on the "B" state, when it is brought to its initial state. > > > > > I understand why this could be slightly surprising, but this is > expected behavior. > > There are two rules of execution that combine here: > (a) When a state machine follows a transition, it must leave the > source state (and enter the target) > (b) A state machine must be in all or none of the orthogonal siblings > (or regions of a parallel) at any given time > > Now, with the above in mind, while processing "anAEvent" the state > machine must leave its source state "A" which happens to be a region > of the parallel, thereby the other region "B" must also be exited. On > reentry into these regions, the rest states are "A2" (explicit target > of transition) and "B1" (initial in absence of any explicit target). > > Clearly, this behavior may not be what you desire. Couple of ways to > correct this and obtain the behavior you are after: > (1) Avoid having transitions that are placed in direct child states of > parallel, this may be done by having an intermediate "wrapper" state. > (2) Define the transition as "internal" so source state is not exited > in this case -- this is easier in theory but not supported by Commons > SCXML at the moment (patches to add support welcome). > > -Rahul > > > > Tested on the svn revision 1143657, last changed date 2011-06-07 01:13:06 > > +0200 (Tue, 07 Jun 2011). > > > > I am attaching the output log from the engine execution. > > > > 2011-07-25 12:26:56,419 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel > > 2011-07-25 12:26:56,420 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/A > > 2011-07-25 12:26:56,421 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/B > > 2011-07-25 12:26:56,421 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/A/A.1 > > 2011-07-25 12:26:56,421 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/B/B.1 > > 2011-07-25 12:26:56,425 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdata = null > > 2011-07-25 12:26:56,426 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdatamap = > > {B.entry=null, parallel.entry=null, A.1.entry=null, B.1.entry=null, > > A.entry=null} > > 2011-07-25 12:26:56,451 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdata = null > > 2011-07-25 12:26:56,451 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdatamap = > > {B.entry=null, parallel.entry=null, A.1.entry=null, B.1.entry=null, > > A.entry=null} > > 2011-07-25 12:26:56,452 DEBUG > [org.apache.commons.scxml.SCXMLExecutor:538] : > > Current States: [A.1, B.1] > > 2011-07-25 12:26:56,452 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdata = null > > 2011-07-25 12:26:56,452 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdatamap = > > {anEvent=null} > > 2011-07-25 12:26:56,459 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:53] : /parallel/B/B.1 > > 2011-07-25 12:26:56,459 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:53] : /parallel/A/A.1 > > 2011-07-25 12:26:56,459 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:53] : /parallel/B > > 2011-07-25 12:26:56,459 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:53] : /parallel/A > > 2011-07-25 12:26:56,459 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:63] : transition (event > = > > anEvent, cond = null, from = /parallel/A, to = /parallel/A/A.2) > > 2011-07-25 12:26:56,459 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:63] : transition (event > = > > anEvent, cond = null, from = /parallel/B, to = /parallel/B/B.2) > > 2011-07-25 12:26:56,460 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/A > > 2011-07-25 12:26:56,460 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/B > > 2011-07-25 12:26:56,460 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/A/A.2 > > 2011-07-25 12:26:56,460 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/B/B.2 > > 2011-07-25 12:26:56,460 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdata = null > > 2011-07-25 12:26:56,460 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdatamap = > > {B.entry=null, B.exit=null, B.2.entry=null, A.2.entry=null, > B.1.exit=null, > > A.exit=null, A.1.exit=null, A.entry=null} > > 2011-07-25 12:26:56,465 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdata = null > > 2011-07-25 12:26:56,465 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdatamap = > > {B.entry=null, parallel.entry=null, A.1.entry=null, B.1.entry=null, > > A.entry=null} > > 2011-07-25 12:26:56,465 DEBUG > [org.apache.commons.scxml.SCXMLExecutor:538] : > > Current States: [B.2, A.2] > > 2011-07-25 12:26:56,465 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdata = null > > 2011-07-25 12:26:56,465 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdatamap = > > {anAEvent=null} > > 2011-07-25 12:26:56,469 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:53] : /parallel/B/B.2 > > 2011-07-25 12:26:56,469 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:53] : /parallel/A/A.2 > > 2011-07-25 12:26:56,469 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:53] : /parallel/B > > 2011-07-25 12:26:56,470 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:53] : /parallel/A > > 2011-07-25 12:26:56,470 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:63] : transition (event > = > > anAEvent, cond = null, from = /parallel/A, to = /parallel/A/A.3) > > 2011-07-25 12:26:56,470 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/A > > 2011-07-25 12:26:56,470 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/B > > 2011-07-25 12:26:56,470 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/A/A.3 > > 2011-07-25 12:26:56,470 INFO > > [org.apache.commons.scxml.env.SimpleSCXMLListener:44] : /parallel/B/B.1 > > 2011-07-25 12:26:56,470 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdata = null > > 2011-07-25 12:26:56,471 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdatamap = > > {B.entry=null, B.exit=null, B.2.exit=null, A.3.entry=null, A.exit=null, > > B.1.entry=null, A.entry=null, A.2.exit=null} > > 2011-07-25 12:26:56,473 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdata = null > > 2011-07-25 12:26:56,474 DEBUG > > [org.apache.commons.scxml.env.SimpleContext:165] : _eventdatamap = > > {B.entry=null, parallel.entry=null, A.1.entry=null, B.1.entry=null, > > A.entry=null} > > 2011-07-25 12:26:56,474 DEBUG > [org.apache.commons.scxml.SCXMLExecutor:538] : > > Current States: [A.3, B.1] > > > > > > > > Hynek > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > --20cf303a2b3d17748f04a9075ad5--