You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mike Tillberg (JIRA)" <ji...@apache.org> on 2009/01/10 07:26:01 UTC

[jira] Created: (SCXML-105) Current status updated after onentry is called

Current status updated after onentry is called
----------------------------------------------

                 Key: SCXML-105
                 URL: https://issues.apache.org/jira/browse/SCXML-105
             Project: Commons SCXML
          Issue Type: Bug
    Affects Versions: 0.9
            Reporter: Mike Tillberg
            Priority: Minor
             Fix For: 0.10
         Attachments: CustomActionTest.patch

When retrieving the current state using a custom action in the onentry section of a state, the state is incorrect.  The state retrieved is the previous state.  The problem appears to be in SCXMLExecutor.triggerEvents, where updateStatus() is called after semantics.executeActions().  Adding an additional updateStatus() before executeActions() seems to fix the problem, and all tests still pass.

Attached is a test case showing the problem.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SCXML-105) Current status updated after onentry is called

Posted by "Mike Tillberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662798#action_12662798 ] 

Mike Tillberg commented on SCXML-105:
-------------------------------------

  That would work for the test case, it wouldn't be sufficient if there are parallel states.  Although it may be possible to look at Action.getParent to see if it's an OnEntry and compare the current state against getParentTransitionTarget to derive the real current state.  Would it make sense to change:

semantics.executeActions();
updateStatus(step);

to

semantics.executeExitActions();
semantics.executeTransitionActions();
try {
    updateStatus(step);
    semantics.executeEntryActions();
} catch (ModelException me) {
    restoreStatus(step);  // using step's beforestatus
    throw me;
}

  updateStatus changes both the current state list and event list, so it may make sense to split that as well to prevent recalculating the ancestor closure.


> Current status updated after onentry is called
> ----------------------------------------------
>
>                 Key: SCXML-105
>                 URL: https://issues.apache.org/jira/browse/SCXML-105
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.9
>            Reporter: Mike Tillberg
>            Priority: Minor
>             Fix For: 0.10
>
>         Attachments: custom-state-01.xml, CustomActionTest.patch, GetStateAction.java
>
>
> When retrieving the current state using a custom action in the onentry section of a state, the state is incorrect.  The state retrieved is the previous state.  The problem appears to be in SCXMLExecutor.triggerEvents, where updateStatus() is called after semantics.executeActions().  Adding an additional updateStatus() before executeActions() seems to fix the problem, and all tests still pass.
> Attached is a test case showing the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SCXML-105) Current status updated after onentry is called

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662735#action_12662735 ] 

Rahul Akolkar commented on SCXML-105:
-------------------------------------

This behavior is actually by design, though somewhat subtle. Since any transitions on the state machine are supposed to be atomic operations, the status is not updated until all the necessary steps to complete the transition are done without any fatal errors. This includes the executable content onexit of source state, in transition and onentry of target state. However, finding out the parent transition target (state) for actions within an onentry block is fairly straightforward -- in Action#execute(), the Action#getParentTransitionTarget() method will give the parent transition target if needed.


> Current status updated after onentry is called
> ----------------------------------------------
>
>                 Key: SCXML-105
>                 URL: https://issues.apache.org/jira/browse/SCXML-105
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.9
>            Reporter: Mike Tillberg
>            Priority: Minor
>             Fix For: 0.10
>
>         Attachments: custom-state-01.xml, CustomActionTest.patch, GetStateAction.java
>
>
> When retrieving the current state using a custom action in the onentry section of a state, the state is incorrect.  The state retrieved is the previous state.  The problem appears to be in SCXMLExecutor.triggerEvents, where updateStatus() is called after semantics.executeActions().  Adding an additional updateStatus() before executeActions() seems to fix the problem, and all tests still pass.
> Attached is a test case showing the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SCXML-105) Current status updated after onentry is called

Posted by "Mike Tillberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Tillberg updated SCXML-105:
--------------------------------

    Attachment: CustomActionTest.patch

Patch to the CustomActionTest unit tests

> Current status updated after onentry is called
> ----------------------------------------------
>
>                 Key: SCXML-105
>                 URL: https://issues.apache.org/jira/browse/SCXML-105
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.9
>            Reporter: Mike Tillberg
>            Priority: Minor
>             Fix For: 0.10
>
>         Attachments: CustomActionTest.patch
>
>
> When retrieving the current state using a custom action in the onentry section of a state, the state is incorrect.  The state retrieved is the previous state.  The problem appears to be in SCXMLExecutor.triggerEvents, where updateStatus() is called after semantics.executeActions().  Adding an additional updateStatus() before executeActions() seems to fix the problem, and all tests still pass.
> Attached is a test case showing the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SCXML-105) Current status updated after onentry is called

Posted by "Mike Tillberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Tillberg updated SCXML-105:
--------------------------------

    Attachment: custom-state-01.xml

State model

> Current status updated after onentry is called
> ----------------------------------------------
>
>                 Key: SCXML-105
>                 URL: https://issues.apache.org/jira/browse/SCXML-105
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.9
>            Reporter: Mike Tillberg
>            Priority: Minor
>             Fix For: 0.10
>
>         Attachments: custom-state-01.xml, CustomActionTest.patch, GetStateAction.java
>
>
> When retrieving the current state using a custom action in the onentry section of a state, the state is incorrect.  The state retrieved is the previous state.  The problem appears to be in SCXMLExecutor.triggerEvents, where updateStatus() is called after semantics.executeActions().  Adding an additional updateStatus() before executeActions() seems to fix the problem, and all tests still pass.
> Attached is a test case showing the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SCXML-105) Current status updated after onentry is called

Posted by "Mike Tillberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662705#action_12662705 ] 

Mike Tillberg commented on SCXML-105:
-------------------------------------

  The additional updateStatus call may not be the correct fix.  When that is in place, getting the state in an onExit or in a transition returns the destination state.  It looks like this may be a deeper problem.  SCXMLSemantics.executeActions is defined to execute "all OnExit/Transition/OnEntry transitional actions", which would infer that the same state would be current for all of those sections.


> Current status updated after onentry is called
> ----------------------------------------------
>
>                 Key: SCXML-105
>                 URL: https://issues.apache.org/jira/browse/SCXML-105
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.9
>            Reporter: Mike Tillberg
>            Priority: Minor
>             Fix For: 0.10
>
>         Attachments: custom-state-01.xml, CustomActionTest.patch, GetStateAction.java
>
>
> When retrieving the current state using a custom action in the onentry section of a state, the state is incorrect.  The state retrieved is the previous state.  The problem appears to be in SCXMLExecutor.triggerEvents, where updateStatus() is called after semantics.executeActions().  Adding an additional updateStatus() before executeActions() seems to fix the problem, and all tests still pass.
> Attached is a test case showing the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SCXML-105) Current status updated after onentry is called

Posted by "Mike Tillberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Tillberg updated SCXML-105:
--------------------------------

    Attachment: GetStateAction.java

Custom action

> Current status updated after onentry is called
> ----------------------------------------------
>
>                 Key: SCXML-105
>                 URL: https://issues.apache.org/jira/browse/SCXML-105
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.9
>            Reporter: Mike Tillberg
>            Priority: Minor
>             Fix For: 0.10
>
>         Attachments: custom-state-01.xml, CustomActionTest.patch, GetStateAction.java
>
>
> When retrieving the current state using a custom action in the onentry section of a state, the state is incorrect.  The state retrieved is the previous state.  The problem appears to be in SCXMLExecutor.triggerEvents, where updateStatus() is called after semantics.executeActions().  Adding an additional updateStatus() before executeActions() seems to fix the problem, and all tests still pass.
> Attached is a test case showing the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SCXML-105) Current status updated after onentry is called

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662806#action_12662806 ] 

Rahul Akolkar commented on SCXML-105:
-------------------------------------

Thanks for your patches and suggestions. In the spirit of the latest suggestion, more changes would be needed though. During a transition, you'd be in neither the source nor target states (however, theoretically transitions are supposed to be instantaneous so state chart theory doesn't need to address that very much). So it'd look something like:

// here status returns source(s) as current states
semantics.executeExitActions();
// here status returns no current states (which is quite bad IMO)
semantics.executeTransitionActions();
// here status returns target(s) as current states
semantics.executeEntryActions();

I will try to clarify with the Working Group what the consensus is regarding the behavior here, but I'd be inclined to not make any changes until such time.


> Current status updated after onentry is called
> ----------------------------------------------
>
>                 Key: SCXML-105
>                 URL: https://issues.apache.org/jira/browse/SCXML-105
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.9
>            Reporter: Mike Tillberg
>            Priority: Minor
>             Fix For: 0.10
>
>         Attachments: custom-state-01.xml, CustomActionTest.patch, GetStateAction.java
>
>
> When retrieving the current state using a custom action in the onentry section of a state, the state is incorrect.  The state retrieved is the previous state.  The problem appears to be in SCXMLExecutor.triggerEvents, where updateStatus() is called after semantics.executeActions().  Adding an additional updateStatus() before executeActions() seems to fix the problem, and all tests still pass.
> Attached is a test case showing the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.