cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davide Gesino <>
Subject Re: mutithread issues in interceptors and endpoints
Date Wed, 27 Feb 2008 07:33:06 GMT

> Looking at the code (this seems to be some code that came from XFire), 
> there is some ScopePolicy things that seem to do various things, but 
> they seem to be very confusing and also won't work with the 
> JAXWSMethodInvoker anyway due to that singleton factory thing.    
> There's PROBABLY a way to use the 
> org.apache.cxf.service.invoker.LocalFactory with a  RequestScopePolicy 
> thing to have it create a new instance of each request.   Maybe.  I'm 
> not really sure if any of that is working and it's all very confusing.  
> I'm tempted to rip that all out and just have a couple different 
> factories.  (SingleInstanceFactory, PerRequestFactory, SessionFactory, 
> PooledFactory,  etc...)

I have tried the following code, and actually it works fine, it creates a
new endpoint bean instance for each request.

ScopePolicy policy = RequestScopePolicy.instance();
org.apache.cxf.common.util.factory.Factory factory = new
JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(fattorazza, policy);

JaxWsServerFactoryBean factoryBean = new JaxWsServerFactoryBean();
Endpoint.publish(address, implementor);

Just a note on the RequestScopePolicy: it seem to be a singleton, but the
constructor is not private, so the singletor factory can be violated, here
is the code.

public class RequestScopePolicy implements ScopePolicy {
    private static final RequestScopePolicy SINGLETON = new

    public Factory applyScope(Factory f, Exchange ex) {
        return f;

    public static ScopePolicy instance() {
        return SINGLETON;
View this message in context:
Sent from the cxf-user mailing list archive at

View raw message