Ok thanks for that - in answer to your comments. All I have to do is limit the number of simultaneous connections from our single JVM, if we run two instances of our application, we do not have to limit across servers, just for the current JVM.
Since all interaction with the service provider is via a couple of jaxws:clients defined in the spring context, I am hoping I can coordinate throttling between them all. Its frustrating but its required and I can't get around it. Will have a look at it directly. On Mon, May 28, 2012 at 4:04 PM, Freeman Fang <[email protected]> wrote: > Hi, > > May not answer your question directly, but as the service provider has > connection limitation, IMO it's hard to control the connection count from > client side, you possibly have multiple clients even on different hosts > launched by different person, how could one client know other client's > connection? Using a global process to maintain the different clients > connections is so ugly. > > For your scenario, I believe the new cxf server side asynchronous handling > introduced since CXF 2.6.0 should help, it leverage CXF continuation API > hence won't block the transport level thread, you may need take a look at > jaxws_async example shipped with CXF 2.6.0 kit to get more details. > > Freeman > > On 2012-5-28, at 上午11:29, Jason Pell wrote: > >> Hi, >> >> I have a requirement to be able to throttle my jaxws:client >> connections to an external web service. So lets say the service >> provider requires me to limit the number of simultaneous connections >> to their web site to be 10 connections. I was thinking I could use a >> counting semaphore with a constructor arg of 10 and then call acquire >> before opening the connection to the external web service and >> release() when i receive the response and close the connection. The >> external calls are synchronous. >> >> However I am not sure where to start looking at this. It would be >> awesome if I could include this into the HttpConduit class. >> >> The other thing to keep in mind is that I have the potential to have >> multiple jaxws:client that refer to the same external url, and so I >> want to be able throttle the total connections across both client >> beans. >> >> I guess what I would like to do is share a HttpConduit across both >> clients (the url would be exactly the same for both of the clients) >> >> The reason why I can have two clients pointing at the same url, is I >> have xslt transformations in the interceptors so they expose different >> interfaces but get mapped to the same one going out to the external >> service. >> >> Could I provide my own HttpConduit implementation, or would this be >> something that CXF would be interested in having contributed? > > > --------------------------------------------- > Freeman Fang > > FuseSource > Email:[email protected] > Web: fusesource.com > Twitter: freemanfang > Blog: http://freemanfang.blogspot.com > http://blog.sina.com.cn/u/1473905042 > weibo: http://weibo.com/u/1473905042 > > > > > > > > > >
