File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does JavaRebel handle objects created using old class schema?

 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Jevgeni Kabanov
Java Rebel Support
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Kuladip Yadav
Ranch Hand
Posts: 162
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic