2012-06-25 33 views
2

我收到以下警告,然後提供了使用在Jetty上運行的CXF(2.5.2)創建的服務的NPE。有人知道如何增加執行程序隊列的大小,正如警告中所建議的那樣?增加CXF中的執行程序隊列大小OneWayProcessorInterceptor

org.apache.cxf.interceptor.OneWayProcessorInterceptor handleMessage 
WARNING: Executor queue is full, run the oneway invocation task in 
caller thread. Users can specify a larger executor queue to avoid 
this. 

WARNING: Interceptor for 
{http://docs.oasis-open.org/wsn/bw-2}MyPublishService#{http://docs.oasis-open.org/wsn/bw-2}Notify 
has thrown exception, unwinding now 
java.lang.NullPointerException 
     at org.apache.cxf.jaxws.context.WrappedMessageContext.<init>(WrappedMessageContext.java:107) 
     at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:53) 
     at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75) 
     at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) 
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
     at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
     at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
     at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106) 
     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) 
     at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:232) 
     at org.apache.cxf.interceptor.OneWayProcessorInterceptor.handleMessage(OneWayProcessorInterceptor.java:143) 
     ... 

更新:感謝接受的答案我已經創建了一個包含以下內容的Spring bean一個XML文件:

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation=" 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> 

    <bean id="cxf.default.workqueue" class="org.apache.cxf.workqueue.AutomaticWorkQueueImpl"> 
     <property name="name" value="default" /> 
     <property name="queueSize" value="512" /> 
    </bean> 
</beans> 
+0

我面臨同樣的問題。你能告訴我你複製bean配置文件的位置以及部署描述符中的相應配置以讀取此文件嗎? – CKing

+0

您只需創建一個帶有正確內容的文件(例如cxf.xml)並將其添加到您的類路徑中。 – Laurent

+0

是的,我想通了。將它添加到我的beans.xml文件中,該文件也用於發佈我的Web服務。 – CKing

回答

2

這是不容易配置(您需要註冊自己的實例AutomaticWorkQueue進入巴士申請)。處理@OneWay調用的最大線程數的默認值爲256,這意味着服務器可以在不阻止調用者線程的情況下同時服務多達256個@OneWay請求。

在你的情況下,用戶可以創建org.apache.cxf.workqueue.AutomaticWorkQueueImpl類型的彈簧豆具有屬性name="default" &組隊列大小&線程初始數,高&低範圍按說明書http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-rt-core/2.1.4/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java

+0

感謝您的信息,我更新了我的問題。 – Laurent

+0

@Laurent +1在服務器/容器詳細信息[Jetty]上的說明,您已在您的問題中更新。 –

+0

嗨,你的第一個建議,怎麼做?你有沒有參考如何實施它?我有一個問題,我的出站響應被阻塞,因爲我的出站客戶端請求正在使用這個工作區。基本上我也在向外部實體發送出站請求。我有一個也收到請求的端點。他們都共享相同的AutomaticWorkQueue。我的理解是否正確?這是我能找到的唯一原因,即使我已經完成處理,爲什麼我的回覆花費太長時間。 –