【发布时间】:2017-10-10 08:37:45
【问题描述】:
我有一个camelRoute,它应该在一个拆分中使用一个线程池来做并行工作。我的问题是我总是以一个线程结束太多,因为拆分将运行一个线程,线程池运行指定数量的线程。我希望线程池限制线程数量。
任何人都知道为什么会发生这种情况?下面的路线和骆驼上下文...(代码中的其他值,例如 from 和 id 等,但不能在这里显示...)
from(FROM_ENDPOINT)
.routeId(ID)
.split(body(), new GroupedExchangeAggregationStrategy())
.executorServiceRef("ThreadPool")
.bean(bean, "beanMethod")
.end()
.bean(bean)
.multicast()
.to(TO_ENDPOINT);
ThreadPool 在我的 camel-context.xml 中是这样配置的:
<camel:camelContext id="application-context" useMDCLogging="true" xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="properties" location="ref:props"/>
<routeBuilder ref="refToRoute"/>
<threadPoolProfile id="ThreadPool" maxPoolSize="2"
maxQueueSize="-1" poolSize="2"/>
</camel:camelContext>
【问题讨论】:
标签: multithreading concurrency split apache-camel threadpool