You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2007/01/31 20:59:05 UTC

[jira] Resolved: (CXF-323) Improper synchronization of getDefaultBus(), setDefaultBus()

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

Daniel Kulp resolved CXF-323.
-----------------------------

       Resolution: Fixed
    Fix Version/s: 2.0-RC

> Improper synchronization of getDefaultBus(), setDefaultBus()
> ------------------------------------------------------------
>
>                 Key: CXF-323
>                 URL: https://issues.apache.org/jira/browse/CXF-323
>             Project: CXF
>          Issue Type: Bug
>            Reporter: Jarek Gawor
>         Assigned To: Daniel Kulp
>             Fix For: 2.0-RC
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.