On Monday, February 13, 2012 5:59:40 PM Alois wrote:
> On 02/08/2012 10:38 PM, Daniel Kulp wrote:
> > On Wednesday, February 08, 2012 6:13:31 PM Alois wrote:
> >>    Hi all,
> >> 
> >> I'm setting up a web service using JaxWsServerFactoryBean.
> >> How can I make resources available to the service class? Is it supported
> >> that a constructor with parameters is called when instantiating the
> >> service class?
> > 
> > Not directly, no.  However, you can create the bean yourself and then call
> > factory.setServiceBean(bean) with it.   Thus, CXF doesn't control the
> > construction of the bean, you would.
> > 
> > Dan
> 
> Thanks, Dan.
> 
> Are there more differences between the two approaches?
> Is there a single instance of the service class, that is used from all
> service threads, in both cases?

Per JAX-WS spec, the service is normally a singleton and all requests would go 
into that single instance and would be accessed from all the service threads.   
In both cases above, that would be true.


> Or can exist multiple instances?
> Is any documentation available about the instantiation of the service
> class and the access to its instances by different threads?

However, you can register a custom invoker 
(org.apache.cxf.service.invoker.Invoker) that does different things if needed.  
 
For example, you could do:

new JAXWSMethodInvoker(new SessionFactory(class))

and it would create a new instance per session.   There are a couple different 
Factories that we have (Pooled, Spring, Session, PerRequest, etc...) that 
could be used.

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to