• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic