I'm confused about something; it looks like ClassPool is a shared static singleton instance.
The ClassPool picks up classes off the classpath.
What if these classes are part of a WAR or EJB JAR? What happens when the module is reloaded? How does the ClassPool purge out-of-date classes when a module is reloaded / redeployed?
I would like to manage my own ClassPool singleton, storing it as a ServletContext attribute. When the WAR or EAR is redeployed, we'd recreate the ClassPool instance inside the ServletContext. Haven't quite seen how to do that, yet. Am I on the right track?
You can create as many ClassPool objects as you
want. To do this, say:
ClassPool cp = new ClassPool(null);
cp.appendSystemPath();
cp.insertClassPath("."); // or else.