commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r600780 - in /commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke: AsyncTrigger.java SimpleSCXMLInvoker.java
Date Tue, 04 Dec 2007 03:56:18 GMT
Author: rahul
Date: Mon Dec  3 19:56:17 2007
New Revision: 600780

URL: http://svn.apache.org/viewvc?rev=600780&view=rev
Log:
SCXML-60 Possible race condition in AsyncTrigger
Reported by Andy Bailey <andy at hazlorealidad dot com>

Modified:
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/AsyncTrigger.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/SimpleSCXMLInvoker.java

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/AsyncTrigger.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/AsyncTrigger.java?rev=600780&r1=600779&r2=600780&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/AsyncTrigger.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/AsyncTrigger.java
Mon Dec  3 19:56:17 2007
@@ -29,11 +29,11 @@
 class AsyncTrigger implements Runnable {
 
     /** The state machine executor. */
-    private SCXMLExecutor executor;
+    private final SCXMLExecutor executor;
     /** The event(s) to be triggered. */
-    private TriggerEvent[] events;
+    private final TriggerEvent[] events;
     /** The log. */
-    private Log log = LogFactory.getLog(AsyncTrigger.class);
+    private final Log log = LogFactory.getLog(AsyncTrigger.class);
 
     /**
      * Constructor.
@@ -45,6 +45,12 @@
         this.executor = executor;
         this.events = new TriggerEvent[1];
         this.events[0] = event;
+    }
+
+    /**
+     * Fire the trigger(s) asynchronously.
+     */
+    public void start() {
         new Thread(this).start();
     }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/SimpleSCXMLInvoker.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/SimpleSCXMLInvoker.java?rev=600780&r1=600779&r2=600780&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/SimpleSCXMLInvoker.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/invoke/SimpleSCXMLInvoker.java
Mon Dec  3 19:56:17 2007
@@ -116,7 +116,7 @@
         if (executor.getCurrentStatus().isFinal()) {
             TriggerEvent te = new TriggerEvent(eventPrefix + invokeDone,
                 TriggerEvent.SIGNAL_EVENT);
-            new AsyncTrigger(parentSCInstance.getExecutor(), te);
+            new AsyncTrigger(parentSCInstance.getExecutor(), te).start();
         }
     }
 
@@ -137,7 +137,7 @@
         if (!doneBefore && executor.getCurrentStatus().isFinal()) {
             TriggerEvent te = new TriggerEvent(eventPrefix + invokeDone,
                 TriggerEvent.SIGNAL_EVENT);
-            new AsyncTrigger(parentSCInstance.getExecutor(), te);
+            new AsyncTrigger(parentSCInstance.getExecutor(), te).start();
         }
     }
 
@@ -149,7 +149,7 @@
         cancelled = true;
         TriggerEvent te = new TriggerEvent(eventPrefix
             + invokeCancelResponse, TriggerEvent.SIGNAL_EVENT);
-        new AsyncTrigger(parentSCInstance.getExecutor(), te);
+        new AsyncTrigger(parentSCInstance.getExecutor(), te).start();
     }
 
 }



Mime
View raw message