On 19/05/2010 13:06, Alex Objelean wrote:
Please, correct me if I'm wrong, but the Application won't become the root of
child threads. Using InheritableThreadLocal will only make Application
available from the threads created during a request cycle. There is
absolutely no memory related problem with it.
As I said, some operations may spawn threads, like manipulation images,
for example.
If your application call it (during a request cycle), the application
object will be stored in a system thread.
Take a look at this:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6489540
This currently make web-classloader leaks. If you start using
InheritableThreadLocal's with arbitrary objects, you're going to make
even more leaks.
Also note, there is something not good here. AFAIK, Wicket sets the
thread locals only during the request. But if child threads are spawned,
they can't be cleaned automatically. IMO, it should be done something
that the user needs to call to set/clear this, like a specialized
WicketThread class.
Adriano