[concurrency-interest] Question about re-ordering

Nader Aeinehchi nader at aeinehchi.com
Tue Jan 17 18:11:42 EST 2012


Hi

In the following, a listener is notified by some configurator.  Question 
is whether a re-ordering may be enforced by compiler on the operations 
on "stateMap"?  Is it safe to assume that stateMap.clear() is always run 
before stateMap.put within the same thread?

     public void notify(ConfigurationEvent event) {
         if (event.getType() == AbstractFileConfiguration.EVENT_RELOAD) {
             logger.warn("log something");

             stateMap.clear();

             List<SubnodeConfiguration> configurations = 
xmlConfiguration.configurationsAt("*");
             for (SubnodeConfiguration subnodeConfiguration : 
configurations) {
                 
stateMap.put(subnodeConfiguration.getString("@configurationId"), new 
State(subnodeConfiguration));
             }
         }
     }

Thanks


More information about the Concurrency-interest mailing list