This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

URLClassloader in webapp  RSS feed

 
Askar Kalykov
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using url-classloader in my webapp.
In general, there is class A:


on ServletContextListener.init() A.init() is called, and on ServletContextListener.destroy() A.destroy() is called.

Objects created by that classloader are used in TimerTasks (no references to TimerTasks are stored).
Before calling A.destroy(), I'm calling .cancel() on Timer, that invokes those TimerTasks.

The problem is: on webapp unloading Tomcat erases all but jars, that has been used, when creating classloader in createClassLoader() method, therefore Tomcat can not fully unsinstall or redeploy that webapp.

How can I unload objects and classes loaded by my classLoader?
Is this problem somehow related to Timer, that I'm using for working with that objects?
[ October 22, 2006: Message edited by: Askar Kalykov ]
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you use standard URL class loader? Are your classes in http:// form? If you use file:/ based URL then classes can be locked and can't be deleted.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!