cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [jira] [Created] (CXF-6963) Setting ThreadLocal specific property on RequestContext is still not thread-safe
Date Wed, 06 Jul 2016 13:50:11 GMT

             Summary: Setting ThreadLocal specific property on RequestContext is still not
                 Key: CXF-6963
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 3.1.6, 3.1.0
Redhat Enterprise Linux (Santiago), OpenJDK 7, Tomcat 7
            Reporter: RANADEEP SHARMA


I have a overridden factory for JaxWS proxy clients, as shown below. I created this class
as per the link -

Here's the spring config
    <bean id="proxyFactory" class="com.vcf.soap.jaxws.TSafeJaxWsProxyFactoryBean">
        <property name="serviceClass" value=""/>
        <property name="address" value="${session.manager.service.uri}"/>

    <bean id="sessionManagerServiceClient" class=""
          factory-bean="proxyFactory" factory-method="create"/>

    <bean id="sessionManagerWrapper" class="">
        <property name="sessionManagerService" ref="sessionManagerServiceClient" />
        <property name="endpointUri" value="${session.manager.service.uri}" />

Here goes the classes

public class TSafeJaxWsProxyFactoryBean extends JaxWsProxyFactoryBean {

    public TSafeJaxWsProxyFactoryBean() {

    public TSafeJaxWsProxyFactoryBean(ClientFactoryBean fact) {

    protected ClientProxy clientClientProxy(Client c) {
        ClientProxy clientProxy = super.clientClientProxy(c);

        clientProxy.getRequestContext().put("thread.local.request.context", "true");

        return clientProxy;

In my application, I have 2 methods that use the proxy created by the above factory. One method
- getSessionInfo() populates the BindingProvider.ENDPOINT_ADDRESS_PROPERTY into the RequestContext
before the service call. Another method - startSession() just calls service without populating
above property.

public class SessionManagerWrapperImpl {

    public SessionInfo startSession() {
        Map<String, Object> requestContext = ((BindingProvider)       sessionManagerService).getRequestContext();
        if(requestContext.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) {
        // Make service call using 'sessionManagerService'
    public SessionInfo getSessionInfo(String sessionId) {

        ((BindingProvider) sessionManagerService).getRequestContext()
                .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUri + ";jsessionid="
+ sessionId);
        SessionInfo result = sessionManagerService.getSessionInfo(sessionId);

Now, I am getting into a situation where RequestContext is already having the mentioned property
for the thread processing startSession(). This is not expected, since CXF documentation claims
the explained usage to be thread-safe. 

Please let me know if my understanding and implementation is correct. However, if my usage
is correct, is there a possible bug in CXF?

NOTE : i have already created a user thread -

This message was sent by Atlassian JIRA

View raw message