Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to auto re-load the classes without shutting down the JVM?  RSS feed

 
babu Jay
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Does anyone have any thoughts as to how to auto re-load the classes, which have been loaded into JVM using Custom Class loader? I tried writing custom class loader and loaded all the classes, but don't know how to re-load the same class, if it has been modified (re-compiled) without shutting down JVM, similar to JSP engine, where if we put updated JSP file, it picks up the new file.
Note: I learnt that, we need to recreate new class loader and load all the classes again, but don't know exactly how to apply that technique in the system. Any help is greatly appreciated.
Thank you,
Babu
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Certainly you have to dump the class loader to purge all of its loaded classes from memory. Bear in mind this can be complicated if there are relationships between classes in different class loaders.
Once that reference is destroyed, however, it should be possible to create a new class loader and instantiate new objects of the same type (but possibly different codebases).
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First ensure that their are no classes loaded by it. Which means run the GC and make sure all objects are collected. Then the classLoader itself should be available for collection. After that, you should be able to load a new classLoader to reload the same classes.
I dont know how much automation you can expect in this process though..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!