It has some good info. At the end it even talks about reloading a class much like a web app would reload a new servlet, discarding the old one. For the most part, I understand how all this works. The one area that is foggy to me is how to do what is described at the end of the artcile (page 5); Live Replacement. Again, I do understand what it means, I just am not sure how to actually go about doing this. Posted below is the excerpt from the article. Can somebody please explain to me how you "discard" all class references from a classloader, set it to null, etc so that the JVM will mark it for GC and I can "reload" the new version of the class (using a new instance of a classloader)??! I'd very much appreciate any help or pointers.
EXCERPT: Live replacement -- The third reason you might need a class loader is if you want to swap out a customization as an application is running. In other words, class loaders will enable you to dynamically extend your application with a class named Mouse, and later, to throw away that Mouse and dynamically extend the application with another class also named Mouse. You can't do this with forName() because once a type is loaded into a name space, it can't be removed unless the whole name space is removed.
With a class loader, you can throw away a particular class loader object by dropping out all references to it, to any instances of any classes it loaded, and to any Class instances for the types it loaded. When you drop all these references, the class loader object and all the classes it loaded become unreferenced and available for garbage collection by the JVM. You can then create a new class loader object with a fresh (and empty) name space, and load the revised versions of the classes you just threw out with the old name space. This is how Web servers (running 24 hours a day, 7 days a week) enable servlet programmers to replace a servlet with a new version of the same servlet.