camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Memory leak in camel mail component
Date Thu, 03 Feb 2011 10:42:56 GMT
On Wed, Feb 2, 2011 at 11:52 PM, Christian Müller
<christian.mueller@gmail.com> wrote:
> Claus is right.
> I made a little test which shows that the number of endpoints grows until we
> reach 1000 cached endpoints...
>

The endpoints may still be created in JMX and thus "eat up" memory.
You can try running the test with JMX enabled and then check using
jconsole, and see if you have more than 1000 endpoint mbeans.



> {code}
> import javax.mail.internet.AddressException;
>
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Test;
> import org.jvnet.mock_javamail.Mailbox;
>
> public class MemoryLeakTest extends CamelTestSupport {
>
>    private long loopCount = 20000;
>
>    @Test
>    public void test() throws AddressException {
>        Mailbox.clearAll();
>
>        for (int index = 0; index < loopCount; index++) {
>            String endpointUrl =
> "smtp://localhost?username=srinivasa@localhost" +
>            "&password=XXXXXX&to=srinivasa" + index + "@localhost" +
>            "&from=srinivasa@localhost&consumer.delay=6000&subject=message"
> + index;
>            template.sendBody(endpointUrl , "asdfsadfsample");
>            Mailbox.clearAll();
>            System.out.println(context.getEndpoints().size());
>        }
>    }
> }
> {code}
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message