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] Resolved: (SCXML-60) Possible race condition in AsyncTrigger
Date Tue, 04 Dec 2007 04:01:43 GMT

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

Rahul Akolkar resolved SCXML-60.
--------------------------------

    Resolution: Fixed

Fixed in SVN, thanks for your input, I've added your name to the project contributors section.


> 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