First, once get("Point") is called, the ClassPool object
keeps the CtClass object representing the Point class
forever. Even if you remove a class path, the CtClass
object is not removed. So you should create another
Second, currently all instances of ClassPool share
a single class loader for executing toClass(). Hence,
you cannot reload a class. Do you think I should
make each instance of ClassPool have a distinct
I think you should allow the ability to have multiple loaders. This will expand your library so that it can be used in a number of new types of systems.
We are looking to allow users to hot deploy and update libraries withouth having to bring down the system.
Hmm... if you want to implement hot deploy,
you should not use toClass(). Rather you
should use javassist.Loader or write your own
class loader. For more details, please read
the API document of ClassPool#writeAsClass(Stirng)
and the section 4 of the tutorial.
toClass() is a convenience method; not for complex
I tried writing my own loader. However, whenever a jar containing class is updated. The following error is thrown when trying to define the class:
java.lang.LinkageError: duplicate class definition
I am not sure if what I am looking for is possible. I will update the thread if I come up with something.
Thanks for the help!.