繁体   English   中英

CXF HTTP连接池CLOSE_WAIT

[英]CXF HTTP Connection pooling CLOSE_WAIT

我正在使用CXF 3.0.6

我正在使用ProducerTemplate调用路线

我在骆驼上下文中有一个cxf端点,如下所示。(TEST_ENDPOINT是实际的端点)

<route id="invokePostRestService">
        <from uri="direct:invokeWS" />
        <log message=" ${body}" />
       <to uri="cxf://{{TEST_ENDPOINT}}?dataFormat=payload&amp;loggingFeatureEnabled=true" />
       <log message=" ${body}" />
</route>


<http-conf:conduit name="*.http-conduit">
                <http-conf:client ConnectionTimeout="30000"
                        ReceiveTimeout="30000"  MaxRetransmits="1"
                        AllowChunking="false" />
        </http-conf:conduit>

        <bean id="systemProps"
                class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
                <property name="targetObject" value="#{@systemProperties}" />
                <property name="targetMethod" value="putAll" />
                <property name="arguments">
                        <util:properties>
                                <prop key="http.maxConnections">11</prop>

                        </util:properties>
                </property>
        </bean>

我认为CXF日志记录以某种方式干扰了Jetty / resources / log4j.xml中的log4j.xml,当我在log4j.xml中将日志记录级别设置为ERROR时,我看到CLOSE_WAIT堆积并且http.maxConnections超过100+(作为实际上它只有11个,已配置)

当我在log4j.xml中将日志记录模式设置为INFO时,一切正常,并且http.maxConnections为11! 正如预期的那样,没有close_waits!

调试后,尽管log4j.xml中出现错误,我仍然看到“ org.apache.camel.processor.interceptor.BacklogDebugger”中的日志记录级别是INFO,这可能是此问题的原因吗?

任何帮助表示赞赏...

这可能会帮助面临相同问题的其他人。

调试后,我发现在初始化骆驼上下文时,也会初始化内部称为BacklogTracer的日志记录拦截器(Trace拦截器),在内部将INFO用作日志记录级别。

因此,在上下文xml中添加cxf:bus,如下所示,参考-

http://cxf.apache.org/docs/bus-configuration.htmlc
<cxf:bus>
        <cxf:features>
            <cxf:logging />
        </cxf:features>
</cxf:bus>

然后在log4j.xml中添加它,

<logger name="org.apache.cxf" >
    <level value="INFO" />  
</logger>

希望这可以帮助..

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM