commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar (JIRA)" <j...@apache.org>
Subject [jira] Updated: (SCXML-60) Possible race condition in AsyncTrigger
Date Mon, 22 Oct 2007 14:36:50 GMT

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

Rahul Akolkar updated SCXML-60:
-------------------------------

    Fix Version/s: 0.7

Setting fix version to v0.7 so it gets fixed in the next release.

Out of curiosity, did you actually observe this problem, what JDK etc.?


> Possible race condition in AsyncTrigger
> ---------------------------------------
>
>                 Key: SCXML-60
>                 URL: https://issues.apache.org/jira/browse/SCXML-60
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Andy Bailey
>            Priority: Minor
>             Fix For: 0.7
>
>
> In AsyncTrigger (used by SimpleSCXMLInvoker) a thread is started from inside the constuctor,
because of the java memory model the fields arent guaranteed to be written until after the
constructor ends, however the thread could start before this and so the values could be null.
> To be safe the class should have a start method that gets invoked after the constructor.
>   AsyncTrigger(final SCXMLExecutor executor, final TriggerEvent event) {
>         this.executor = executor;
>         this.events = new TriggerEvent[1];
>         this.events[0] = event;
>         new Thread(this).start();
>     }
>  public void run() {
>         try {
>             synchronized (executor) {
>                 executor.triggerEvents(events);
>             }
>         } catch (ModelException me) {
>             log.error(me.getMessage(), me);
>         }
>     }

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


Mime
View raw message