cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jarek Gawor (JIRA)" <j...@apache.org>
Subject [jira] Created: (CXF-323) Improper synchronization of getDefaultBus(), setDefaultBus()
Date Fri, 22 Dec 2006 04:27:21 GMT
Improper synchronization of getDefaultBus(), setDefaultBus()
------------------------------------------------------------

                 Key: CXF-323
                 URL: http://issues.apache.org/jira/browse/CXF-323
             Project: CXF
          Issue Type: Bug
            Reporter: Jarek Gawor


getDefaultBus() method in org.apache.cxf.bus.spring.SpringBusFactory and org.apache.cxf.bus.cxf.CXFBusFactory
is improperly synchronized. The method is instance-level synchronized while it initializes
and accesses a class-level variable. Two different instances of BusFactory each calling getDefaultBus()
at the same time could return two different Bus instances...

This method should either be changed to 'public static synchronized Bus getDefaultBus()' or
modified as for an example:

public Bus getDefaultBus() {
  return initDefaultBus();
}

private static synchronized Bus initDefaultBus() {
  if (null == defaultBus) {
         defaultBus = new CXFBusImpl();
  }
  return defaultBus;
}

Also, the setDefaultBus() method in both classes needs to be properly synchronized. 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message