You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by at...@apache.org on 2014/09/07 21:48:47 UTC
svn commit: r1623146 - in
/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2:
SCXMLExecutor.java env/SimpleScheduler.java invoke/SimpleSCXMLInvoker.java
Author: ate
Date: Sun Sep 7 19:48:46 2014
New Revision: 1623146
URL: http://svn.apache.org/r1623146
Log:
SCXML-206: External events must only be added to the event queue through SCXMLExecutor#addEvent, not (also) trigger them, as the state machine can/should only handle one invocation at the time (non-reentrant). The event queue processing with sequentially processed such added events one at a time.
Modified:
commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java
commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleScheduler.java
commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java
Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java?rev=1623146&r1=1623145&r2=1623146&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java Sun Sep 7 19:48:46 2014
@@ -370,9 +370,7 @@ public class SCXMLExecutor implements SC
*/
public void triggerEvent(final TriggerEvent evt)
throws ModelException {
- if (evt != null) {
- externalEventQueue.add(evt);
- }
+ addEvent(evt);
triggerEvents();
}
@@ -390,9 +388,7 @@ public class SCXMLExecutor implements SC
throws ModelException {
if (evts != null) {
for (TriggerEvent evt : evts) {
- if (evt != null) {
- externalEventQueue.add(evt);
- }
+ addEvent(evt);
}
}
triggerEvents();
@@ -437,5 +433,4 @@ public class SCXMLExecutor implements SC
log.debug(sb.toString());
}
}
-}
-
+}
\ No newline at end of file
Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleScheduler.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleScheduler.java?rev=1623146&r1=1623145&r2=1623146&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleScheduler.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleScheduler.java Sun Sep 7 19:48:46 2014
@@ -126,13 +126,7 @@ public class SimpleScheduler implements
if (log.isWarnEnabled()) {
log.warn("<send>: Unavailable target - " + target);
}
- try {
- this.executor.triggerEvent(new TriggerEvent(
- EVENT_ERR_SEND_TARGETUNAVAILABLE,
- TriggerEvent.ERROR_EVENT));
- } catch (ModelException me) {
- log.error(me.getMessage(), me);
- }
+ this.executor.addEvent(new TriggerEvent(EVENT_ERR_SEND_TARGETUNAVAILABLE,TriggerEvent.ERROR_EVENT));
return; // done
}
@@ -232,12 +226,7 @@ public class SimpleScheduler implements
@Override
public void run() {
timers.remove(sendId);
- try {
- executor.triggerEvent(new TriggerEvent(event,
- TriggerEvent.SIGNAL_EVENT, payload));
- } catch (ModelException me) {
- log.error(me.getMessage(), me);
- }
+ executor.addEvent(new TriggerEvent(event, TriggerEvent.SIGNAL_EVENT, payload));
if (log.isDebugEnabled()) {
log.debug("Fired event '" + event + "' as scheduled by "
+ "<send> with id '" + sendId + "'");
Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java?rev=1623146&r1=1623145&r2=1623146&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java Sun Sep 7 19:48:46 2014
@@ -125,11 +125,7 @@ public class SimpleSCXMLInvoker implemen
return; // no further processing should take place
}
boolean doneBefore = executor.getCurrentStatus().isFinal();
- try {
- executor.triggerEvent(evt);
- } catch (ModelException me) {
- throw new InvokerException(me.getMessage(), me.getCause());
- }
+ executor.addEvent(evt);
if (!doneBefore && executor.getCurrentStatus().isFinal()) {
TriggerEvent te = new TriggerEvent("done.invoke."+parentStateId,TriggerEvent.SIGNAL_EVENT);
new AsyncTrigger(parentIOProcessor, te).start();
@@ -142,11 +138,7 @@ public class SimpleSCXMLInvoker implemen
public void cancel()
throws InvokerException {
cancelled = true;
- try {
- executor.triggerEvent(new TriggerEvent("cancel.invoke."+parentStateId, TriggerEvent.CANCEL_EVENT));
- } catch (ModelException me) {
- throw new InvokerException(me.getMessage(), me.getCause());
- }
+ executor.addEvent(new TriggerEvent("cancel.invoke."+parentStateId, TriggerEvent.CANCEL_EVENT));
}
}