gpt4 book ai didi

java - CXF 在不更改 http.maxConnections 的情况下增加连接池大小

转载 作者:可可西里 更新时间:2023-11-01 16:18:59 25 4
gpt4 key购买 nike

我最近被要求将 CXF 配置为与我们旧的 XFire 服务相同的参数。

其中一个参数是 Keep-Alive: timeout=60, max=20。但是,我做了一些研究,似乎 CXF 在底层使用了 JVM HttpURLConnection 对象。 From what I see ,已经有一些尝试为其提供配置,但目前还没有提交任何内容。

我不想更改 http.maxConnections 参数,因为它会影响所有服务器,而不仅仅是 CXF 网络服务。

我找到了这个 interresting forum thread在 Daniel Kulp 那里谈论它时说:

BTW: there is a way to control the connection pooling, but it's a SERVER side thing. Basically, if the server sends back a header of:

Keep-Alive: timeout=60, max=5

then the Java client will respect those values. Right now in CXF, you would probably need to write an interceptor to set those values. I just made a commit to trunk that expands the http configuration to include a setting to control this from the config file.

我可以编写一个拦截器来修改 header 来执行此操作。但是我的问题是:服务器将如何应对这种变化?如果服务器期望最多 5 个连接而客户端执行更多连接,那不是问题吗?

最佳答案

据我所读here , keep-alive 参数可以通过系统属性或直接在 HTTP header 中进行控制:

The support for HTTP keep-Alive is done transparently. However, it can be controlled by system properties http.keepAlive, and http.maxConnections, as well as by HTTP/1.1 specified request and response headers.

关于java - CXF 在不更改 http.maxConnections 的情况下增加连接池大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9664384/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com