Thanks Daniel,

Just to make sure I understand it, you're saying for most cases it
will be thread safe, and for some cases I can specify it to use
ThreadLocal state for RequestContext's.

My use case is basically every user of my web application will make a
request to this external web service through the web application
something kinda like this (in the real system we're using JAAS and
using the SOAP web service as our remote Credential checking system):


private static Services ss = new Services(wsdlURL);
private static Services port = ss.getServicesSoap12();

public void handleLogin(Request req) {
            ss = new Services(wsdlURL);
            port = ss.getServicesSoap12();
            port.onLogin(req.getParameter("name"));
}


On Thu, Jan 15, 2009 at 2:02 PM, Daniel Kulp <[email protected]> wrote:
>
>
> CXF proxies ARE thread safe except for a couple of scenarios:
>
> 1) Use of the port.getRequestContext().   By default per JAX-WS spec, the
> request context is per port.   Thus, any settings set on that will affect
> other threads using the proxy.    You CAN do:
> port.getRequestContext().put("thread.local.request.context", "true");
> and future calls to getRequestContext() will use a thread local context.    In
> CXF, the response context is always thread local.
>
> 2)  Certain settings on the http conduit.   The conduit is per port, so
> anything that the conduit manipulates would not be safe.   The main one is
> sessions.   The session cookie is handled in the conduit.    Thus, the port
> is associated with a single session (if session is turned on).    Similarly,
> if you change the TLS settings, those would reflect across all the threads.
>
> Basically, for the most part, you can create a single port and use it for MOST
> use cases.
>
> Does that help at all?
>
> Dan
>
>
> On Thursday 15 January 2009 1:11:59 pm dougnukem wrote:
> > Gattu, Praveen wrote:
> > > 3)Is the calls to the actual service sequential and does threads get
> > > blocked on one another? If so is there a way I could configure CXF to
> > > create a pool of connection objects for each port, is so how would I do
> > > that. If not should I(a client) manage these external connection pools?
> >
> > Has there been any future response to this question?
> >
> > I'm interfacing with a SOAP web service from a JETTY servlet, and when
> > handling mutliple requests we create a new Services and port for each
> > request.
> >
> > Would I be able to reuse a single Service and port and have multiple
> > requests (threads) calling methods on it? Or would the suggested solution
> > be to create a limited pool of these ports and block requests until one of
> > those pooled objects is available?
>
>
>
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog

Reply via email to