commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ant Kutschera (JIRA)" <>
Subject [jira] Created: (SCXML-156) Need a better way of setting initial state in instances of SCXMLExecutor
Date Fri, 27 Aug 2010 09:56:53 GMT
Need a better way of setting initial state in instances of SCXMLExecutor

                 Key: SCXML-156
             Project: Commons SCXML
          Issue Type: Improvement
    Affects Versions: 0.9
         Environment: local j2se
            Reporter: Ant Kutschera
            Priority: Minor


I have states RESERVED->BOOKED->PAID.  The initial state is RESERVED.  I create a business
entity which has this state and I need to persist it in state BOOKED.

I persist the state as a varchar / String.  I don't want to persist a state machine in my

When I load the entity in order to update the state to "PAID", I need to instantiate the state
machine, and update the state to "BOOKED", since that is the status my object really has.

I can do this, only by modifying the InitialTarget of the SCXML using the API.  That isn't
nice, because I only want one instance of SCXML, because loading the XML is expensive in terms
of time/cpu etc.  The solution I've used now is to do the update in a synchronized block,
while being synchronized on the SCXML instance, and then after I instantiate the SCXMLExecutor,
I put the state back in the SCXML to the original initial state.

Ideally, I would be able to pass the "starting state" to the constructor of the SCXMLExecutor,
to indicate that I am starting from a partially run workflow, if that makes sense.

See this blog article too:

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

View raw message