我正在使用Apache camel 2.16.0和CXF 3.1.2
如何为所有http调用配置连接池(在cxf.xml中),以便它可以重用现有的http连接而不是每次都创建新连接?
我也看到每个请求都有TIME_WAIT,CLOSE_WAIT和FIN_WAIT2,如何关闭空闲连接?
<bean id="http" class="org.apache.camel.component.http.HttpComponent">
<property name="camelContext" ref="camel_context" />
<property name="httpConnectionManager" ref="myHttpConnectionManager" />
</bean>
<bean id="myHttpConnectionManager"
class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
<property name="params" ref="myHttpConnectionManagerParams" />
</bean>
<bean id="myHttpConnectionManagerParams"
class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
<property name="connectionTimeout" value="20000" />
<property name="soTimeout" value="20000" />
<property name="defaultMaxConnectionsPerHost" value="5" />
<property name="maxTotalConnections" value="10" />
</bean>
似乎maxTotalConnections无效! maxTotalConnections是10,但是当我进行负载测试时,我可以看到超过230个ESTABLISHED连接..不仅如此 所有属性如connectionTimeout,soTimeout,defaultMaxConnectionsPerHost都被忽略了!
任何帮助表示赞赏..