【发布时间】:2018-10-13 23:18:32
【问题描述】:
我在 JBoss Fuse 中运行了几条骆驼路线(大约 100 条)。最近我遇到了 OutOfMemoryError: Java heap space,所以我决定使用 Eclipse Memory Analyzer Tool 来寻找漏洞。
报告显示了几个嫌疑人,但最大的一个是:
11.539 个实例的“org.apache.http.impl.conn.PoolingHttpClientConnectionManager”,已加载 通过“org.apache.felix.framework.BundleWiringImpl$BundleClassLoaderJava5 @ 0xd16558b8" 占用 443.624.920 (63,87%) 个字节。
与其他泄漏问题不同,此案例的详细信息报告很小,只有 4 行:
类 java.lang.Thread @ 0xd0a9c0c8
\class org.apache.camel.component.jms.DefaultJmsMessageListenerContainer @ 0xd367ee58 .\class org.apache.camel.component.jms.JmsQueueEndpoint @ 0xd36750d8
..\class org.apache.camel.blueprint.BlueprintCamelContext @ 0xd33bcd50
http连接好像有问题,但我真的不知道。
我在 pollEnrichers 中这样使用 http 组件:
from(URI_COLA_ENTRADA_STEP)
.pollEnrich().simple("{{URL_CORRELATIVO}}?ruta=STEP", String.class).aggregationStrategy(new EstrategiaCorrelativo()).cacheSize(1).timeout(10000).aggregateOnException(true)
.to(URI_TOPIC_ARTICULOS);
或在处理器中使用 ProducerTemplate:
final String URL = exchange.getContext().resolvePropertyPlaceholders("{{URL_PAGO}}");
ProducerTemplate producer = exchange.getContext().createProducerTemplate();
String response = producer.requestBody(URL, "", String.class);
producer.stop();
所以,如您所见,我没有做太复杂的事情。
什么可能导致问题?
【问题讨论】:
标签: java memory-leaks apache-camel eclipse-memory-analyzer