camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] Created: (CAMEL-2175) Initialization code of camel-cxf is not thread safe
Date Mon, 16 Nov 2009 13:33:52 GMT
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
             Fix For: 2.1.0, 2.2.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.


Mime
View raw message