簡體   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