On Friday 09 July 2010 5:32:23 pm am am wrote: > So you mean that there is a pool connections kept by the framework and > uses the next available? It is not possible to send 2 POSTs over the same > connection? It is against the HTTP standard?
For the most part, yes. With keep-alives, you can reuse the connection for future requests, but there can only be one outstanding request on the connection at a time. > Also If I would want to use multiple threads to send multiple POSTs to the > same web service (same port different operation), to increase performace > (e.g. I call this methods from a GUI) the threads would block due to the > maximum number of connections the HttpURLConnection object makes to the > same web server? Likely yes, but I have no idea what the limit is in the HttpURLConnection or if there is one. There might not be a limit in which case you would probably hit whatever limit the server may have. One a related note: Metro/JAXWS-RI also uses the HttpURLConnection so it's behavior would be similar. Dan > > > > > > ________________________________ > From: Daniel Kulp <[email protected]> > To: [email protected] > Cc: am am <[email protected]> > Sent: Fri, July 9, 2010 8:54:36 PM > Subject: Re: Asynchronous Invocation > > On Friday 09 July 2010 4:49:17 am am am wrote: > > Hi, I would like to understand how the asynchronous invocation model > > works. If for example I use Future<?> invokeAsync(T msg, AsyncHandler<T> > > handler) then my program can resume and when the response from the web > > service arrives, the result will be passed to my AsyncHandler. > > If I have several threads in the same program and one thread calls > > invokeAsync and resumes operation and immediately another thread (perhaps > > more) tries to also call invokeAsync to the same web service (perhaps > > different operation but same portType) how will this situation be handled > > by the framework? a) Will a series of POSTs go the same web service (POST > > for thread1, POST for thread2 etc) or b) after a response arrives then > > the next POST will be send (POST for thread1 when response arrives pass > > result to the callback handler and then POST for thread2?). If you > > follow approach (a) you push the POSTs over the same TCP connection? > > Internally, a new HttpURLConnection object is created everytime any invoke > (or invokeASync) method is called. The HttpURLConnection pretty much > manages most of the above. If there is a free "keep-alive" connection > avail, it uses it. If not, it creates a new one. -- Daniel Kulp [email protected] http://dankulp.com/blog
