[ 
https://issues.apache.org/activemq/browse/CAMEL-2175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=55478#action_55478
 ] 

William Tam commented on CAMEL-2175:
------------------------------------

Hi Claus, FYI the "getAndSet" there was to make sure that the CxfBinding was 
injected with HeaderFilterStrategy since HeaderFilterStrategy could be 
initialized after CxfBinding.  (We weren't guaranteed that setBinding() is 
called after setHeaderFilterStrategy().)  With your fix, the Camel's Service 
start() method will get called to perform the initializations which is good.  
We shouldn't need that "getAndSet" anymore.  That is great.  Please also fix 
the same issue in RestletBinding.  thx.

> Initialization code of camel-cxf is not thread safe
> ---------------------------------------------------
>
>                 Key: CAMEL-2175
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2175
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.0.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.1.0
>
>
> getCxfBinding is not thread safe in case multiple threads hit a CXF webserive 
> at once and it hasnt been initialized before.
> Code like this
> {code}
>     public CxfBinding getCxfBinding() {
>         if (cxfBinding == null) {
>             cxfBinding = new DefaultCxfBinding();   
>             if (LOG.isDebugEnabled()) {
>                 LOG.debug("Create default CXF Binding " + cxfBinding);
>             }
>         }
>         
>         if (!cxfBindingInitialized.getAndSet(true) 
>                 && cxfBinding instanceof HeaderFilterStrategyAware) {
>             ((HeaderFilterStrategyAware)cxfBinding)
>                 .setHeaderFilterStrategy(getHeaderFilterStrategy());
>         }
>         return cxfBinding;
>     }
> {code}
> Is a false sense as the {{getAndSet}} will let other threads pass it with a 
> cxfBinding that still may not have been initialized.

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

Reply via email to