[ 
https://issues.apache.org/jira/browse/SCXML-61?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rahul Akolkar updated SCXML-61:
-------------------------------

    Fix Version/s: 0.7

This will be fixed in v0.7 only to the effect of adding explicit Javadoc 
enhancements as you suggest.

Invoke has necessarily asynchronous semantics, and tends toward long(er) 
running interaction semantics. For synchronous interactions, custom actions 
(executable content) are more appropriate. AsyncTrigger was left out of the 
public API by design (as you indicate, it may not please everyone).


> Infinite loop if an Invoker fires the done event in invoke method
> -----------------------------------------------------------------
>
>                 Key: SCXML-61
>                 URL: https://issues.apache.org/jira/browse/SCXML-61
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.6
>         Environment: all platforms
>            Reporter: Andy Bailey
>            Priority: Minor
>             Fix For: 0.7
>
>
> With the following code
> public class HazInvoker implements Invoker
> {
> @Override public void invoke(String source, Map parameters) throws 
> InvokerException
>       {
>               System.out.println("Invoker invoke source: "+source+" params: 
> "+parameters);            
>               SCXMLExecutor executor = scInstance.getExecutor();              
>               TriggerEvent event=new 
> TriggerEvent(parentStateId+".invoker.done", TriggerEvent.SIGNAL_EVENT); 
>               
>               //new AsyncTrigger(executor, event);
>                       try
>                       {
>                               executor.triggerEvent(event);
>                       }
>                       catch (ModelException ex)
>                       {                       
>                               ex.printStackTrace();
>                       }
>       }
> Exception in thread "main" java.lang.StackOverflowError
>       at java.util.Vector.addElement(Vector.java:573)
>       at java.util.Stack.push(Stack.java:50)
> ...
>       at 
> org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.initiateInvokes(SCXMLSemanticsImpl.java:824)
>       at 
> org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:142)
>       at 
> org.apache.commons.scxml.SCXMLExecutor.triggerEvent(SCXMLExecutor.java:160)
>       at com.hazlorealidad.fsm.HazInvoker.invoke(HazInvoker.java:37)
>       at 
> org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.initiateInvokes(SCXMLSemanticsImpl.java:824)
>       at 
> org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:142)
>       at 
> org.apache.commons.scxml.SCXMLExecutor.triggerEvent(SCXMLExecutor.java:160)
>       at com.hazlorealidad.fsm.HazInvoker.invoke(HazInvoker.java:37)
> The fix is to use the AsyncTrigger but the class is package private, I would 
> be good to change it to public and document the way to write a synchronous 
> invoker in the invoke method. 
> Something like:
> "If the Invoker completes its invocation in the invoke method it should 
> signal the completion of the task using an AsyncTrigger, in order to avoid a 
> stack overflow"
> Or maybe there is another solution which would allow the event to be fired in 
> the invoke method.
> Also it would be good to avoid the creation of a thread just for that, maybe 
> an invokeLater method in the executor, like the swing dispatch loop.

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

Reply via email to