camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (CAMEL-2818) DOCS:report incident tutorial has leaky code. (recreates producerTemplate())
Date Tue, 06 Jul 2010 09:15:52 GMT

     [ https://issues.apache.org/activemq/browse/CAMEL-2818?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen resolved CAMEL-2818.
--------------------------------

         Assignee: Claus Ibsen
    Fix Version/s: 2.4.0
       Resolution: Fixed

Updated the docs

> DOCS:report incident tutorial has leaky code. (recreates producerTemplate()) 
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-2818
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2818
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: documentation, examples, website
>         Environment: Tomcat 6.0.26
>            Reporter: Karl Palsson
>            Assignee: Claus Ibsen
>            Priority: Trivial
>             Fix For: 2.4.0
>
>
> On http://camel.apache.org/tutorial-example-reportincident-part4.html in the section
labelled: {{Adding the RouteBuilder}}, there is some code labelled as being inside the web
service operation...
> {code:java}
> public OutputReportIncident reportIncident(InputReportIncident parameters) {
>         Object mailBody = context.createProducerTemplate().sendBody("direct:start", parameters);
>         System.out.println("Body:" + mailBody);
>         // return an OK reply
>         OutputReportIncident out = new OutputReportIncident();
>         out.setCode("OK");
>         return out;
>     }
> {code}
> The commentary underneath makes special note of obtaining the producerTemplate with {{context.createProducerTemplate()}}
 
> However, using this example code will result in leaks of DirectProducer objects (under
camel 2.1.x) or ThreadPoolExecutors (under camel 2.3.x) and eventual heap exhaustion.
> A web service implementation class should create a single producer template, and reuse
it.  Alternatively, there's something wild and wooly going on that's preventing the template
from being garbage collected.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message