【问题标题】:CXF HTTP Connection pooling CLOSE_WAITCXF HTTP 连接池 CLOSE_WAIT
【发布时间】:2016-09-12 11:10:33
【问题描述】:

我正在使用 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 !

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

感谢任何帮助...

【问题讨论】:

    标签: java web-services logging apache-camel cxf


    【解决方案1】:

    这可能会对面临同样问题的其他人有所帮助。

    经过调试,我发现当骆驼上下文被初始化时,称为 BacklogTracer 的内部日志拦截器(跟踪拦截器)也被初始化,它在内部使用 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>
    

    希望这会有所帮助..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-20
      • 1970-01-01
      • 2017-02-03
      • 1970-01-01
      • 2015-05-07
      • 2016-07-09
      • 2012-04-08
      相关资源
      最近更新 更多