dcsimg
Threads in ServletContextListener
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, January 13, 2004 07:58 AM

Hi, I am spawning a new thread in contextInitialized method of a ServletContextListener. This new thread keeps track of all the caches(maintained in servletcontext) in an application, and tries to refresh the cache objects periodically from the original resource from which they are built. The Problem I am encountering is that the new thread that has been spawned from the contextInitialized method could not find all the libraries. I am novice in classloader concept but, it seems as if the new thread is in a different classloader than the application. On the other hand if I try to refresh the cache from within the contextInitialized method instead of spawning a new thread, everything works just fine. I thought the child thread will g   More>>

Hi,
I am spawning a new thread in contextInitialized method of a ServletContextListener. This new thread keeps track of all the caches(maintained in servletcontext) in an application, and tries to refresh the cache objects periodically from the original resource from which they are built. The Problem I am encountering is that the new thread that has been spawned from the contextInitialized method could not find all the libraries. I am novice in classloader concept but, it seems as if the new thread is in a different classloader than the application.

On the other hand if I try to refresh the cache from within the contextInitialized method instead of spawning a new thread, everything works just fine.

I thought the child thread will generally inherit all the setting exactly as the parent thread unless changed deliberately.

Please let me know, how I can make the child thread behave same as the parent thread.

Thanks in Advance
Sravan

   <<Less
About | Sitemap | Contact