You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Rahul Akolkar (JIRA)" <ji...@apache.org> on 2007/12/05 00:19:43 UTC
[jira] Resolved: (SCXML-61) Infinite loop if an Invoker fires the
done event in invoke method
[ https://issues.apache.org/jira/browse/SCXML-61?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rahul Akolkar resolved SCXML-61.
--------------------------------
Resolution: Fixed
Added Javadoc clarification per previous comment.
> 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.