• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How does JavaRebel handle objects created using old class schema?

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been reading replies to some of the posts as to how JavaRebel is different from redeployments in a J2EE application. I have a question related to this. Let's assume, i have a class ABC in my application. Lets further assume that this class has an method "sayHello()". During the course of using the application on the server, i create n instances of this class and store one of the instance in the HTTP session. Then, i go and change the class ABC and remove the method sayHello() from it. This changed class file is put in the application. Then i create another instance of ABC. JavaRebel picks up the changes to the class file and loads a new instance. But what about all the previous instances which were loaded using the old class schema? Does JavaRebel destroy those or are they allowed to stay in the JVM? Normally, in a redeployment process, the old instances are discarded, but how is it in JavaRebel?
 
Java Rebel Support
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jaikiran Pai:
Normally, in a redeployment process, the old instances are discarded, but how is it in JavaRebel?



The whole point of JavaRebel is that all the existing instances are preserved, but their code is updated. So in your case the object in the session will be preserved, but it will now be missing the method "sayHello()" (and will have any methods that you added).

Note that we also allow adding new fields without redeploying. In that case they will not be initialized in the existing instances, so you may get some NPEs until you recreate them.
[ August 13, 2008: Message edited by: Jevgeni Kabanov ]
 
Ranch Hand
Posts: 162
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

posted Today 03:18 PM Profile for Jevgeni Kabanov Author's Homepage Email Jevgeni Kabanov Send New Private Message Edit/Delete Post Reply With Quote

quote riginally posted by Jaikiran Pai:
Normally, in a redeployment process, the old instances are discarded, but how is it in JavaRebel?



The whole point of JavaRebel is that all the existing instances are preserved, but their code is updated. So in your case the object in the session will be preserved, but it will now be missing the method "sayHello()" (and will have any methods that you added).

Note that we also allow adding new fields without redeploying. In that case they will not be initialized in the existing instances, so you may get some NPEs until you recreate them.



That's the beauty of Java Rebel. Excellent Feature.
[ August 13, 2008: Message edited by: Kuldeep Yadav ]
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Note that we also allow adding new fields without redeploying. In that case they will not be initialized in the existing instances, so you may get some NPEs until you recreate them.



That's a more appropriate example. I was trying to understand how the old objects would behave when the class schema changes. Thanks for the explanation.
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic