You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christian Lindell <ch...@ericsson.com> on 2010/09/17 16:14:30 UTC

@ThreadScope equivalent in CXF?

Hi!

Is there any equivalent of the JAX-WS RI @ThreadScope in CXF?

Description:
https://jax-ws-commons.dev.java.net/nonav/thread-scope/

I need it in my service (not client) for allowing thread safe access and reuse of connections so it's more or less the same use-case described on that webpage. How can I achieve this?

Thanks!
BR/Christian


Re: @ThreadScope equivalent in CXF?

Posted by Daniel Kulp <dk...@apache.org>.
On Friday 17 September 2010 10:14:30 am Christian Lindell wrote:
> Hi!
> 
> Is there any equivalent of the JAX-WS RI @ThreadScope in CXF?
> 
> Description:
> https://jax-ws-commons.dev.java.net/nonav/thread-scope/
> 
> I need it in my service (not client) for allowing thread safe access and
> reuse of connections so it's more or less the same use-case described on
> that webpage. How can I achieve this?

There are two options:

1) Use the spring scopes and aop-proxy - this is generally what I recommend 
for normal scoping things such as per-request and session scopes as Spring has 
them built in.   Unfortunately, there isn't a "thread" scope built into spring 
2.x (looks like it's added to Spring 3.x). However, there are some blogs/docs 
for adding it:
 http://springindepth.com/book/in-depth-ioc-scope.html
http://blog.progs.be/?p=111


2) The cxf jaxws:endpoint/server config things have an invoker config element 
that can be used to specify a custom invoker.   You can either subclass the 
JAXWSMethodInvoker that we use or provide a custom Factory to it's 
constructor.  You could use one of our factories:

http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/invoker/

as a starting point.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog