【问题标题】:Camel ProducerTemplate possible memory leakCamel ProducerTemplate 可能存在内存泄漏
【发布时间】:2014-10-17 18:15:57
【问题描述】:

在某种程度上,这有点像在黑暗中拍摄,但我们有一个过程会在一天中显着减慢。我们发现在 Fuse 上运行的所有东西都开始拖拽,但只有当我们一直在运行特定进程时。运行 JProfiler,我发现 org.apache.camel.ProducreTemplate.send 上标记的内存使用量随时间增加。

所以我的主要问题是,我们在此处使用 ProducerTemplate 的方式是否缺少一些不正确/可能导致此问题的内容?

Exchange foo = new DefaultExchange(getCamelContext(), ExchangePattern.InOnly);
foo.getIn().setBody(obj);
Route r = exchange.getContext().getRoute("do_something_fun");
ProducerTemplate template = exchange.getContext().createProducerTemplate();
template.send(r.getEndpoint(), foo);

【问题讨论】:

    标签: apache-camel


    【解决方案1】:

    通常你不应该像这里描述的那样在每个请求上创建一个 ProducerTemplate:http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html

    但是,由于我没有您的应用程序的完整图片,您可能会遇到无法重用它的情况,但您必须记住在完成后关闭它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-23
      • 2020-06-12
      • 2011-07-18
      • 1970-01-01
      • 1970-01-01
      • 2011-01-03
      相关资源
      最近更新 更多