On Wednesday 09 March 2011 11:21:13 AM Kessel, Christopher wrote:
> I think I found it. I'm looking at
> org.apache.cxf.transport.http.HTTPConduit.prepare() and it's asking for a
> new connection from the HttpURLConnectionFactory.createConnection(), which
> in turn does a HttpURLConnection.openConnection().
> 
> So, the short answer is, a new connection per request.

Somewhat yet.   Under the covers, HttpURLConnection does maintain a pool of 
connections that can be reused so if there is an idle Keep-Alive connection, 
it will use  that.   However, if there isn't, it will create a new connection.

Dan


> 
> FYI,
> Chris
> 
> -----Original Message-----
> From: Kessel, Christopher [mailto:[email protected]]
> Sent: Wednesday, March 09, 2011 7:30 AM
> To: [email protected]
> Subject: RE: Default simultaneous CXF client connections?
> 
> When you say you use the HTTPUrlConnection, does that mean there's no
> connection pool used and a new HTTPUrlConnection is created for each
> request? I'm trying to hunt through the CXF code and figure out where the
> socket communication actually takes place, but I haven't found it quite
> yet. I'm following the path of ClientProxy, assuming it's down that chain
> somewhere?
> 
> The reason I ask is two-fold:
> 1) If it only maintains 1 connection, the number of threads I have doesn't
> matter since my call to the external server is where my code spends 90% of
> its time waiting. 2) If it opens a connection per request, then I need to
> throttle my side to limit the number of connections.
> 
> I've been using the client to hit the server sort of like I'd use a JDBC
> client backed by a connection pool. In other words, fire and forget and
> the pool take care of the connection end of things :). I'm thinking that's
> probably not appropriate for a CXF client.
> 
> Thanks,
> Chris
> 
> -----Original Message-----
> From: Daniel Kulp [mailto:[email protected]]
> Sent: Friday, March 04, 2011 12:52 PM
> To: [email protected]
> Cc: Kessel, Christopher
> Subject: Re: Default simultaneous CXF client connections?
> 
> On Thursday 03 March 2011 6:14:45 PM Kessel, Christopher wrote:
> > I'm reusing the same client across multiple threads.
> > 
> > At startup I do something like this:
> >     factory = new JaxWsProxyFactoryBean();
> >     client = (MyClient) factory.create();
> > 
> > Then I can have lots of threads concurrently making calls on that one
> > client: client.doMyThing();
> > 
> > I know the client is multithread safe, but I'm not sure how many internal
> > threads the client will use for communication. How many simultaneous
> > connections will CXF (or whatever underlying socket pool) maintain and
> > how do I change that value?
> 
> We really just use the HTTPUrlConnection object to connect to the Server.
> Thus, anything that you may find on google about that would apply to CXF as
> well.     I honestly don't know the answer.  :-(

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

Reply via email to