• 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 create two(or more) different classloader for loading the same class file twice or more

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let I have a class named as Loading..


After some time I want to modify the content of a method afterModifing() the same class as follows

 
Ranch Hand
Posts: 46
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please use lowercase in the titles.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bhagirathi,

1. I've edited your subject line to remove the all-caps. Please read the EaseUp (←click) page on this subject.

2. Could you please re-state your question? I still have no idea what you want, or why you would want to load multiple versions of the same class. A bit of background would be useful. (ie, TellTheDetails (←click)).

Winston
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So if I understand your actual problem description, you have a class which behaves one way, and then after a while (I assume this has a precise definition) you want it to behave differently.

If that's the case, then having two versions of the class and having them both loaded by separate classloaders is, well, um, let me just say, it isn't the most obvious or straightforward way to achieve that. I would achieve that by providing the class with a flag which controls the decisions to work the "early" way and the "late" way, and then just set the flag when you want to switch over.
 
Do you pee on your compost? Does this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic