On 19/05/2010 12:48, Alex Objelean wrote:
Since you've never needed the Application instance in threads you had created, why would you need it from now on? The only problem related to memory leaks may be caused by your custom implementation, not with the fact of using InheritableThreadLocal.
* This class extends <tt>ThreadLocal</tt> to provide inheritance of values * from parent thread to child thread: when a child thread is created, the * child receives initial values for all inheritable thread-local variables * for which the parent has values. Normally the child's values will be * identical to the parent's; however, the child's value can be made an * arbitrary function of the parent's by overriding the <tt>childValue</tt> * method in this class.
As soon a child thread is created, the application will become a "root" of it and will never be collected, even if you not use it.
Adriano