2016-03-08 31 views
2

我在ServiceMix中遇到了驼峰问题。servicemix上的CAMEL线程锁

我通过camel-jetty,servicemix中的骆驼配方列表制作了webservice。 该软件包性能良好,但资源锁定和线程已完全发生。这个系统进程每秒调用40次。

问题是有时池线程没有正确释放。 以下的应用程序,我可以看到使用jstack 工具,某些线程都停留在等待状态的开始几个小时后:

配置如下: - ServiceMix的5.3.0 - 骆驼2.13.2 - 使用成分(骆驼码头,骆驼recipentlist基于Spring DSL)

-source

<route customId="true" > 
<from uri="direct:giop_addr_async"> 
    <recipentList> 
      <simple>jetty://http://api.host.lm?x=${header.x}&y=${header.y}</simple> 
    </recipentList> 
    <bean ref="soapDecode" method="userDecode"/> 
    <to uri="direct:sendEndPoint"> 
</route> 
<route customId="true> 
    <from uri="direct:sendEndPoint"> 
    <to uri="jetty://http://resultMap?httpClient.soTimeout=80000"/> 
</route> 

-------------- LOG

ps -eLf | wc -l --> 32500 



"CamelJettyClient(0x3d0b240d)-26916" damen prio=10 tid=0x000000000ff69800 nid =0x10ef wating on condition [0x00002b4b3ba3f0000] 
    java.lang.Thread.State: TIMED_WAITNG(parking) 
    at sun.misc.Unsafe.park(Native Method) 
- parking to wait for <0x000000006f13f19b0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) 
at java.util.concurrent.locks.LocsSupport.parkNanos(LockSupport,java:226) 
at org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:342) 
at org.eclipse.jetty.util.thread.QueuedThreadPool.idleJobPoss(QueuedThreadPool.java:526) 
at org.eclipse.jetty.tuil.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) 
at java.lnag.thread.run(Thread.java:745) 

上面的日志超过了30000行。

你能提出什么可以检查吗?我错过了什么吗?或者可能是 这是骆驼中的一个错误?

回答

0

使线程处于等待状态并不正常,但30.000线程很多。

您正在使用recipientList:对于x和y的每个组合,您正在创建一个新的码头生产者。每个码头生产者都有自己的线程池,并且骆驼在缓存中保存最后生成的创建者:在这里创建大量的线程池和线程。

您不需要一个recipientList以便动态创建一个URL。您可以使用头Exchange.HTTP_URI

例如:

<route customId="true" > 
<from uri="direct:giop_addr_async"> 
    <setHeader headerName="CamelHttpUri"> 
      <simple>jetty://http://api.host.lm?x=${header.x}&y=${header.y}</simple> 
    </setHeader> 
    <to uri="jetty://http://api.host.lm"/> 
    <bean ref="soapDecode" method="userDecode"/> 
    <to uri="direct:sendEndPoint"> 
</route> 
<route customId="true> 
    <from uri="direct:sendEndPoint"> 
    <to uri="jetty://http://resultMap?httpClient.soTimeout=80000"/> 
</route>