Internals of Java Class Loading
Class loading is one of the most powerful mechanisms provided by the Java language specification. Even though the internals of class loading falls under the "advanced topics" heading, all Java programmers should know how the mechanism works and what can be done with it to suit their needs. This can save time that would otherwise have been spent debugging ClassNotFoundException, ClassCastException, etc.
Binildas has writting this exclusive article on classloaders (in java) and shows you how to create your own classloader.
Note:
I am looking on some article/code snippents/techniques on Class Un-loading. Please do write me link/procedure for unloading classes in the comments of this post.
Related XJB Links:
Classloading and Classloaders
[Resource-Type: Article; Category: Java/J2SE; XRating: 3.5]
Title of this post takes you to the article








3 Comments:
To unload a class remove all (strong) references to the class. Seems straight forward to me.
Note:
o Classes have a reference to their ClassLoader.
o ClassLoaders have references to all the classes they have loaded.
o Threads have strong references to their ThreadLocal values. In particular if you have a ThreadLocal as a static field initialised with a value of ype defined by the same ClassLoader, it leaks.
o IIRC, applets have the last fifty (50) ClassLoaders strongly cached.
o It's presumably a rich area for bugs.
7:22 PM
I have posted the procedure for class unloading in my blog.
5:54 AM
I responded in angsuman's post as well. You have a link to my brainopolis.com/ thread on classloaders in your related links. For some reason that link doesn't work. You may want to update it.
http://www.brainopolis.com/roller/comments/kduffey/Weblog/swt_doesn_t_make_sense
That is the link to the blog I wrote. You posted a link to the comments, but for some reason it doesn't come up.
3:30 PM
Post a Comment
<< Home