• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between Class Unloading and Object Finalization  RSS feed

 
suresh livingston
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Like to know the difference between Class Unloading and Object Finalization.
-------------------------------------------------------------------------------------------------------------------------------------------------
My Understanding:
Among many cases,one case is:
A class gets unloaded after all its instances gets Finalized (i.e finalize() ).

-------------------------------------------------------------------------------------------------------------------------------------------------
Scenario:
But in case of Message Driven Bean, i see that MDB class gets unloaded but still MDB objects are available in pool.
--------------------------------------------------------------------------------------------------------------------------------------------------
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Finalization is something which happens to an object, when it is garbage-collected and deleted from memory. There may be other instances of that class still reachable.
Class unloading occurs when the JVM detects there are no more uses for that class. Obviously first all instances of that class will have to be (at least eligible to be) garbage-collected.
 
suresh livingston
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

However, in my MDB case, dont know why MDB class is getting unloaded first while still its instances are being alive in the pool..
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. Maybe somebody else will know.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!