-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>> this approach does not help me, since when the ActiveMQ is created by
>>>> tomcats webapplication classloader it cannot be undeployed.
>>> You don't have to create the broker in the WAR (or you could put it in
>>> another WAR). This approach works totally fine if you are using the
>>> ActiveMQ JMS client with Camel.
>>>
>> But it requires to put the activemq-core dependency to the webapp for
>> creating the ConnectionFactory for ActiveMQ, doesn't it? Or am I missing
>> something here.
> 
> Yes. How else could you use ActiveMQ from a web app?
> 
Ok, then at least I do not have missunderstood ActiveMQ. :-)

>> Even starting the ConnectionFactory produce memory leaks in the webapp
>> classloader.
> 
> Not sure what you mean by "memory leak in the web app class loader".
> Do you consider adding a class to a class loader a leak? :)
> 
As I described earlier the thread pool usage of ActiveMQ (the
ActiveMQConnectionFactory and TcpTransport use them) keep references
which cause the webapp classloader not to get garbage collected at
undeployment of the webapp.

It is the following way when look at a memory dump:

ActiveMQConnectionFactory creates
java.util.concurrent.ScheduledThreadPoolExecutor with a custom
ThreadFactory.
When the webapp is undeployed the ActiveMQConnectionFactory could not be
garbage collected because the ThreadPool keeps a reference to the
ThreadFactory. This is caused by the following classloader dependencies:
* The ThreadPool is loaded by the bootstrap classloder
* The ThreadFactory is loaded by the webapp classloader
The reference in the ThreadPool (to the ThreadFactory) is not reset to
null (or a class loaded by the bootstrap classloader). So the ThreadPool
held by the bootstrap classloader references the thread factory which
references the webapp classloader.
Thats the leak.

Markus

- --
NMMN - New Media Markets & Networks GmbH
Geschäftsführung: Kfm. Michael Schütt
Finanzamt HH-Altona UStID DE 812 699 852  HRB 71102 Hamburg
HypoVereinsbank  -   BLZ 200 300 00  -  Konto-Nr. 156 29 82

http://www.nmmn.com               Tel.: +49 40 284 118 -0
Langbehnstrasse 6                 Entwicklung:         -720
22761 Hamburg                     Fax:                 -999

Rufen Sie uns kostenlos an: http://www.nmmn.com/call/software
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmkA/AACgkQDBHISU1oEKGRfACgzCuKooGJ2NcHVgBiJeXqb2oO
x+YAoIS9JDpOWA5wMhIpdk/sq9gFpukn
=JamU
-----END PGP SIGNATURE-----

Reply via email to