[ 
https://issues.apache.org/jira/browse/TUSCANY-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12897223#action_12897223
 ] 

Simon Nash commented on TUSCANY-3643:
-------------------------------------

I sent the following by email but didn't get any responses so I am adding it 
here for future reference.

Creating a new instance of ServiceClient for every request could add a fair bit 
of overhead to the request path in the simple common case where only a single 
thread is being used.

Another approach would be to use a pooling/caching approach where the existing 
ServiceClient could be reused if there's no contention between threads, and a 
new ServiceClient could be created if there is contention. There's some code 
like this near the end of RuntimeWireImpl (look for wireReserved and 
cachedWire).


> binding-ws-axis2 should use Axis2 ServiceClient in thread-safe manner
> ---------------------------------------------------------------------
>
>                 Key: TUSCANY-3643
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3643
>             Project: Tuscany
>          Issue Type: Bug
>    Affects Versions: Java-SCA-1.6, Java-SCA-2.0-M5
>            Reporter: Scott Kurz
>            Priority: Minor
>
> In running a version of our 1.x code (the exact version doesn't so much 
> matter since the problem has existed for awhile), against the Axis2 trunk 
> running multiple threads at once, I hit the problem:
> java.lang.NullPointerException
>       at 
> org.apache.axis2.client.ServiceClient.cleanupTransport(ServiceClient.java:860)
>       at 
> org.apache.axis2.client.ServiceClient.createClient(ServiceClient.java:665)
>       at 
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.createOperationClient(..)
>       at 
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invokeTarget(...)
>       at 
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(....)
> It seems Axis2 has introduced a new "autoOperationCleanup" function.   
> So one solution would be to disable this.  However, it seems from discussions 
> such as this:
>   http://www.mail-archive.com/[email protected]/msg48406.html
> that a better solution would be to stop using a single Axis2 ServiceClient 
> across threads, since apparently these are not intended to be thread-safe.    
> So it seems we should switch from using an instance variable to a local 
> variable to hold these refs.

-- 
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